Refactor ObjectCacheStorage to use object_id for object storage#214
Open
yuki-uchida wants to merge 1 commit intonttcom:masterfrom
Open
Refactor ObjectCacheStorage to use object_id for object storage#214yuki-uchida wants to merge 1 commit intonttcom:masterfrom
yuki-uchida wants to merge 1 commit intonttcom:masterfrom
Conversation
This change modifies the ObjectCacheStorage to use `object_id` (and `group_id` where applicable) as the primary key for storing and retrieving objects in `DatagramCache` and `SubgroupStreamCache`, instead of an internally generated `CacheId`. Key changes: - Modified `DatagramCache` to use `(group_id, object_id)` as the key for its `TtlCache`. - Modified `SubgroupStreamCache` to use `object_id` as the key for its `TtlCache`. - Removed the auto-incrementing `CacheId` mechanism from both cache types. - Updated `get_next_object` methods in both caches to find the next object based on `object_id` sequence rather than `CacheId`. - Adjusted `ObjectCacheStorageCommand` variants and the main `object_cache_storage` logic to reflect these changes in parameters and return types. - Updated `ObjectCacheStorageWrapper` and its call sites (primarily in datagram and subgroup stream forwarders) to align with the new API. - Added new unit tests for `DatagramCache` and `SubgroupStreamCache` to cover the new keying and retrieval logic, including tests for non-sequential `object_id`s.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change modifies the ObjectCacheStorage to use
object_id(andgroup_idwhere applicable) as the primary key for storing and retrieving objects inDatagramCacheandSubgroupStreamCache, instead of an internally generatedCacheId.Key changes:
DatagramCacheto use(group_id, object_id)as the key for itsTtlCache.SubgroupStreamCacheto useobject_idas the key for itsTtlCache.CacheIdmechanism from both cache types.get_next_objectmethods in both caches to find the next object based onobject_idsequence rather thanCacheId.ObjectCacheStorageCommandvariants and the mainobject_cache_storagelogic to reflect these changes in parameters and return types.ObjectCacheStorageWrapperand its call sites (primarily in datagram and subgroup stream forwarders) to align with the new API.DatagramCacheandSubgroupStreamCacheto cover the new keying and retrieval logic, including tests for non-sequentialobject_ids.