Page MenuHomeSoftware Heritage
Paste P1163

directory_ls.py
ActivePublic

Authored by vsellier on Sep 15 2021, 11:18 AM.
from swh.storage import get_storage
from swh.model.hashutil import hash_to_bytes
import sys
import time
hash=sys.argv[1]
#print(hash)
#s=get_storage('remote', url='http://swh-storage:5002')
config = {
'cls':'cassandra',
'hosts': ['parasilo-2'],
'keyspace': 'swh',
'consistency_level': 'LOCAL_QUORUM',
'objstorage': {
'cls': 'memory',
'args': {}
}
}
#s=get_storage(cls='cassandra', hosts=['parasilo-2'], keyspace='swh', consistency_level='LOCAL_QUORUM', objstorage={cls='memory'})
s=get_storage(**config)
toc = time.perf_counter()
entries=s.directory_ls(hash_to_bytes(f"{hash}"))
for e in entries:
pass
tac = time.perf_counter()
print(f"{hash}: {tac-toc:0.4f}s")