Implement size estimation function for structs used in history event cache
Still in drafting mode due to git commit is combined with another PR, main change is in the shared.go
What changed? Implement Size() for structs referred in history event cache
Why? We want to modernize existing cadence common cache implement to a bytes-based system. That means we need to have a method to measure each entry (which is currently accepting any generic interface). We found the "Reflect" package provides a measuring function but runtime is too slow to be used in cache operations. Therefore, we will require all usages to implement the Size() function in their cache logic if they want to migrate to the new bytes-based system.
In order to seamless transition from the current cache system with an entry-based model, the implementation and rollout will be done in following phases:
Define the Sizeable interface Implement Sizeable for cadence-history service a. Implement Size() for ExecutionCache b. Implement Size() for EventCache <-- This PR Implement bytes-based cache system Enable new cache system for usage in cadence-history service Implement and enable new cache system for the remaining usages
How did you test it? Unit tests
Potential risks No risk since this PR only adds read-only function that is not used.
Release notes
Documentation Changes