Open pav-kv opened 5 years ago
The current design has 3 types (OperationManager
, SequencerManager
and Sequencer
), which all have their own caches for individual tree IDs.
I propose to shift "caching" one level up the stack, so that OperationManager
merely does couple of things: tracks log IDs and the corresponding masterships, and for each active log ID has an Operation
object. Operation
object encapsulates all "cached" items that were previously scattered across different types (log names, signers, compact ranges, etc), and contains the code for handling only one log (effectively some blend of former SequencerManager
and Sequencer
, but with fixed Tree
/treeID
).
@Martin2112 @AlCutter WDYT?
Yes the structure could be improved. If you're going to cache tree related things then it must be done in a way that's completely safe. You might want to make that a separate work item.
Yep. I will probably start from just restructuring the code with equivalent safety guarantees. For example, consider SequencerManager
and its Signers cache: it is never cleared, and its items are never updated. Same with OperationManager
and log names.
Once it's restructured, we could improve guarantees. E.g. if an Operation
fails, we can delete it altogether, so on the next run it will be re-created with fresh signer, log name, etc.
LogOperation
and its co-types are poorly designed:SequencerManager
(see the list below). We should rather make an explicit per-tree cache that can be extended (e.g. with compact ranges cached between sequencing runs as in #1598).log.NewSequencer
takes aSigner
created from aTree
, but then the sameTree
is passed intosequencer.IntegrateBatch
when in fact there is only oneTree
that can be accepted.log_operation_manager.go
is meant to be agnostic of sequencing, but it contains a bunch of sequencing-related metrics. It is likely thatLogOperation
abstraction is YAGNI.The list of things we cache:
OperationManager
).SequencerManager
).OperationManager
).