-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Runtime Epoch Split] (4/n) Make ShardTracker accessible from RuntimeWithEpochManagerAdapter. #8769
Conversation
d28ac14
to
5132a16
Compare
@robin-near: do you know if someone from core team will review this or do you want me to find a reviewer for you? |
Hmm, I was expecting the core-team alias to resolve to an engineer. Let me try again. |
76551b0
to
fded7b2
Compare
5132a16
to
7ecedc7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pub fn new(tracked_config: TrackedConfig, epoch_manager: Arc<dyn EpochManagerAdapter>) -> Self { | ||
ShardTracker { | ||
tracked_config, | ||
tracking_shards_cache: Arc::new(SyncLruCache::new(1024)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you describe in the code why 1024? The number makes sense to me but writing down the basic thought process why 1024 is large enough but also not too small would be useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed that - thanks!
…WithEpochManagerAdapter.
7ecedc7
to
9043100
Compare
As a reminder of the overall goal, we want to split
RuntimeWithEpochManagerAdapter
, so that any code that needs the runtime will use anArc<RuntimeAdapter>
, and any code that uses the epoch manager will use theEpochManagerHandle
.We're doing this refactoring bottom-up, i.e. propagating
RuntimeWithEpochManagerAdapter
around at the top-level, but making some lower-level components useArc<RuntimeAdapter>
and/orEpochManagerHandle
.Now, it turns out that
ShardsManager
, one of the lower-level components, would need not onlyEpochManagerHandle
, but also an additionalShardTracker
built on top ofEpochManagerHandle
, whose functionality was previously covered byRuntimeWithEpochManagerAdapter
interface.ShardTracker
is not technically part ofEpochManager
either, because it isn't inherent to the epoch part of the protocol, but is controlled by the node operator's config options.ShardTracker
is a field ofNightshadeRuntime
, but is not available in theKeyValueRuntime
; instead, theKeyValueRuntime
implements all theShardTracker
functionalities via theRuntimeWithEpochManagerAdapter
interface. This would not work.This PR moves
ShardTracker
to the near-epoch-manager crate, adds an additionalshard_tracker()
function toRuntimeWithEpochManagerAdapter
to allow passing it down from a higher-level component to a lower-level component, and performs a refactoring to makeKeyValueRuntime
provide theShardTracker
functionality via itsEpochManagerAdapter
implementation. This also required changingShardTracker
to useEpochManagerAdapter
, as opposed to the concreteEpochManagerHandle
.