예제 #1
0


# store index to filesystem
index_name = "index"

# keys for indexin trees (load balance)
hashKeys = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','x','y','z','0','1','2','3','4','5','6','7','8','9','+']

# sotre each index tree to separate file
for h in hashKeys:
	# create file for tree
	f = open(index_name + '/bin_tree_dump_' + h + '.txt','w')

	# get items stored in tree [(k,v)]
	g = index.get_items_generator(h)

	# for each item, dump it to file
	for j in g:
		f.write(json.dumps(j) + "\n")

	# close file for this tree
	f.close()

# create file for object tree
f = open('index/bin_tree_dump_objects.txt','w')


# serialise and store each item to file
g = index.get_items_generator(None)
for j in g: