Skip to content

Commit

Permalink
Merge pull request #245 from sktston/revert-243-feature/redis-log
Browse files Browse the repository at this point in the history
Revert "Add redis log"
  • Loading branch information
baegjae authored Feb 17, 2024
2 parents f954c9c + a0e3b00 commit 4798dee
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
5 changes: 0 additions & 5 deletions aries_cloudagent/storage/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@ def gen_key(self, record_type: str, record_id: str) -> str:
def redis_set_record(self, record: StorageRecord):
redis_key = self.gen_key(record.type, record.id)
try:
LOGGER.info("redis_set_record: %s", redis_key)
self.redis.set(redis_key, record.to_json_string(), ex=self.redis_expire)
except RedisError as e:
LOGGER.warning(f"RedisError: {e}")

def redis_set_record_not_found(self, record_type: str, record_id: str):
redis_key = self.gen_key(record_type, record_id)
try:
LOGGER.info("redis_set_record_not_found: %s", redis_key)
self.redis.set(redis_key, self.RECORD_NOT_FOUND, ex=self.redis_expire)
except RedisError as e:
LOGGER.warning(f"RedisError: {e}")
Expand All @@ -81,7 +79,6 @@ def redis_set_record_list(self, record_type: str, record_id: str, record_list: l
record_json_string_list.append(record.to_json_string())
try:
# no expire for record list to avoid find_all_records
LOGGER.info("redis_set_record_list: %s")
self.redis.set(redis_key, json.dumps(record_json_string_list))
except RedisError as e:
LOGGER.warning(f"RedisError: {e}")
Expand Down Expand Up @@ -174,7 +171,6 @@ async def get_record(self, record_type: str, record_id: str, options: Mapping =
raise StorageError("Record ID not provided")

value = self.redis_get_value(record_type, record_id)
LOGGER.info(f"get_record: {self.gen_key(record_type, record_id)} -> {value}")
if value:
if value == self.RECORD_NOT_FOUND:
raise StorageNotFoundError(f"{record_type} record not found: {record_id}")
Expand Down Expand Up @@ -238,7 +234,6 @@ async def find_all_records(self, type_filter: str, tag_query: Mapping = None, op
record_id = json.dumps({"my_did": tag_query.get("my_did"), "their_did": tag_query.get("their_did")})

value = self.redis_get_value(type_filter, record_id)
LOGGER.info(f"find_all_records: {self.gen_key(type_filter, record_id)} -> {value}")
if value:
record_json_string_list = json.loads(value)
record_list = []
Expand Down
9 changes: 0 additions & 9 deletions aries_cloudagent/wallet/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,13 @@ def redis_set_value(self, record_type: str, record_id: str, value: str):
redis_key = self.gen_key(record_type, record_id)
try:
# no expire for wallet record to avoid get_local_dids
LOGGER.info("redis_set_value: %s", redis_key)
self.redis.set(redis_key, value)
except RedisError as e:
LOGGER.warning(f"RedisError: {e}")

def redis_set_list(self, kv_list: dict):
try:
# no expire for wallet record to avoid get_local_dids
LOGGER.info("redis_set_list")
self.redis.mset(kv_list)
except RedisError as e:
LOGGER.warning(f"RedisError: {e}")
Expand All @@ -79,7 +77,6 @@ def redis_set_record_not_found(self, record_type: str, record_id: str):
redis_key = self.gen_key(record_type, record_id)
try:
# no expire for wallet record to avoid get_local_dids
LOGGER.info("redis_set_record_not_found: %s", redis_key)
self.redis.set(redis_key, self.RECORD_NOT_FOUND)
except RedisError as e:
LOGGER.warning(f"RedisError: {e}")
Expand Down Expand Up @@ -107,7 +104,6 @@ async def create_signing_key(self, key_type: KeyType, seed: str = None, metadata
"""Fetch-item."""
async def get_signing_key(self, verkey: str) -> KeyInfo:
value = self.redis_get_value(self.TYPE_KEY, verkey)
LOGGER.info(f"get_signing_key: {self.gen_key(self.TYPE_KEY, verkey)} -> {value}")
if value:
if value == self.RECORD_NOT_FOUND:
raise WalletNotFoundError(f"Unknown key: {verkey}")
Expand Down Expand Up @@ -157,7 +153,6 @@ async def create_local_did(self,
"""Fetch-item."""
async def get_public_did(self) -> DIDInfo:
value = self.redis_get_value(self.TYPE_DID, self.ID_PUBLIC_DID)
LOGGER.info(f"get_public_did: {self.gen_key(self.TYPE_DID, self.ID_PUBLIC_DID)} -> {value}")
if value:
if value == self.RECORD_NOT_FOUND:
return None
Expand Down Expand Up @@ -207,7 +202,6 @@ async def get_local_dids(self) -> Sequence[DIDInfo]:
"""Fetch-item."""
async def get_local_did(self, did: str) -> DIDInfo:
value = self.redis_get_value(self.TYPE_DID, did)
LOGGER.info(f"get_local_did: {self.gen_key(self.TYPE_DID, did)} -> {value}")
if value:
return DIDInfo.from_json_string(value)

Expand All @@ -220,7 +214,6 @@ async def get_local_did(self, did: str) -> DIDInfo:
"""Fetch-item. Use middleware functions."""
async def get_local_did_for_verkey(self, verkey: str) -> DIDInfo:
value = self.redis_get_value(self.TYPE_DID_FOR_VERKEY, verkey)
LOGGER.info(f"get_local_did_for_verkey: {self.gen_key(self.TYPE_DID_FOR_VERKEY, verkey)} -> {value}")
if value:
if value == self.RECORD_NOT_FOUND:
raise WalletNotFoundError("No DID defined for verkey: {}".format(verkey))
Expand All @@ -243,7 +236,6 @@ async def replace_local_did_metadata(self, did: str, metadata: dict):

# refresh DID and DID_FOR_VERKEY
value = self.redis_get_value(self.TYPE_DID, did)
LOGGER.info(f"replace_local_did_metadata: {self.gen_key(self.TYPE_DID, did)} -> {value}")
if value:
did_info = DIDInfo.from_json_string(value)
did_info = did_info.update_metadata(metadata)
Expand All @@ -252,7 +244,6 @@ async def replace_local_did_metadata(self, did: str, metadata: dict):

# refresh PUBLIC_DID if it is
value = self.redis_get_value(self.TYPE_DID, self.ID_PUBLIC_DID)
LOGGER.info(f"replace_local_did_metadata: {self.gen_key(self.TYPE_DID, self.ID_PUBLIC_DID)} -> {value}")
if value:
did_info = DIDInfo.from_json_string(value)
if did_info.did == did:
Expand Down

0 comments on commit 4798dee

Please sign in to comment.