Skip to content

Commit 5e5c38e

Browse files
author
jkoshy
committedJun 2, 2011
Store slab configuration in the datastore when the -I (initialize) option is specified.
1 parent 89c7f1b commit 5e5c38e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎src/python/datastore/ds_membase.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,11 @@ def __init__(self, config, usethreads=False, writeback=False):
6565
for k in DatastoreMembase.SLAB_CONFIGURATION_KEYS:
6666
slabconfig[k] = config.get(C.DATASTORE, k)
6767
slabconfig[C.CONFIGURATION_SCHEMA_VERSION] = C.CFGVERSION
68-
self.store_element(C.DATASTORE_CONFIG, C.CFGSLAB, slabconfig)
68+
self.slabconfig = slabconfig
6969
else:
7070
# Read slab configuration information from the data store.
71-
slabconfig = self.retrieve_element(C.DATASTORE_CONFIG, C.CFGSLAB)
71+
self.slabconfig = slabconfig = \
72+
self.retrieve_element(C.DATASTORE_CONFIG, C.CFGSLAB)
7273
if slabconfig is not None:
7374
schema_version = slabconfig.get(C.CONFIGURATION_SCHEMA_VERSION)
7475
if schema_version != C.CFGVERSION:
@@ -166,7 +167,11 @@ def store_slab(self, namespace, slabkey, slabelems):
166167

167168
def initialize(self):
168169
"Initialize the database."
170+
# Flush all existing elements.
169171
self.conndb[threading.currentThread().name].flush_all()
170172

173+
# Save the current slab configuration.
174+
self.store_element(C.DATASTORE_CONFIG, C.CFGSLAB, self.slabconfig)
175+
171176

172177
Datastore = DatastoreMembase

0 commit comments

Comments
 (0)
Please sign in to comment.