Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def getIdrCache(self):
if self.idrCache is None:
self.idrCache = IdrCache(self.name,
initKeyValueStorage(self.config.idrCacheStorage,
self.dataLocation,
self.config.idrCacheDbName,
db_config=self.config.db_idr_cache_db_config)
)
return self.idrCache
def open(self):
self.nodesDb = storage.helper.initKeyValueStorage(
self.db_type, self.dataDir, self.nodes_db_name, read_only=self._read_only)
self.leavesDb = storage.helper.initKeyValueStorage(
self.db_type, self.dataDir, self.leaves_db_name, read_only=self._read_only)
self._leafCount = self.leavesDb.size
def loadDomainState(self):
return PruningState(
initKeyValueStorage(
self.config.domainStateStorage,
self.dataLocation,
self.config.domainStateDbName,
db_config=self.config.db_state_config)
)
def _create_state(self, name: str) -> PruningState:
storage_name = getattr(self.config, "{}StateStorage".format(name))
db_name = getattr(self.config, "{}StateDbName".format(name))
if self.data_location is not None:
return PruningState(
initKeyValueStorage(
storage_name,
self.data_location,
db_name,
db_config=self.config.db_state_config))
else:
return PruningState(KeyValueStorageInMemory())
def init_idr_cache_storage(self):
idr_cache = IdrCache(self.node.name,
initKeyValueStorage(self.node.config.idrCacheStorage,
self.node.dataLocation,
self.node.config.idrCacheDbName,
db_config=self.node.config.db_idr_cache_db_config)
)
self.node.db_manager.register_new_store(IDR_CACHE_LABEL, idr_cache)
def loadConfigState(self):
return PruningState(
initKeyValueStorage(
self.config.configStateStorage,
self.dataLocation,
self.config.configStateDbName,
db_config=self.config.db_state_config)
)
line_to_record = str(ledger_id) + ReqIdrToTxn.delimiter + str(seq_no)
dest_seq_no_db_storage.put(digest, line_to_record)
return digest
new_db_name = db_name + '_new'
old_path = os.path.join(db_dir, db_name)
new_path = os.path.join(db_dir, new_db_name)
new_seqno_db_name = config.seqNoDbName + '_new'
attr_store = AttributeStore(
initKeyValueStorage(
config.attrStorage,
db_dir,
config.attrDbName,
db_config=config.db_attr_db_config))
try:
dest_seq_no_db_storage = initKeyValueStorage(config.reqIdToTxnStorage,
db_dir,
new_seqno_db_name)
except Exception:
logger.error(traceback.format_exc())
logger.error("Could not open new seq_no_db storage")
return False
# open new and old ledgers
try:
src_storage = KeyValueStorageRocksdbIntKeys(db_dir, db_name, read_only=True)
except Exception:
logger.error(traceback.format_exc())
logger.error("Could not open old ledger: {}".format(os.path.join(db_dir, db_name)))
return False
try:
def loadConfigState(self):
return PruningState(
initKeyValueStorage(
self.config.configStateStorage,
self.dataLocation,
self.config.configStateDbName)
)
def loadDomainState(self):
return PruningState(
initKeyValueStorage(
self.config.domainStateStorage,
self.dataLocation,
self.config.domainStateDbName)
)