SnapshotManager is a rather messy affair. First of all it is implemented via scattered internal state which manipulated via SnapshotState implementations. This is a weird mix of a behaviours and forwarding objects, leading to really unmaintainable code.
Refactor SnapshotManager to carry polymorphic state object and integrate individual methods in a linear fashion, so that the code becomes clear without unnecessary indirections.
A second objective is to clean up the Follower/SnapshotManager interface w.r.t. InstallSnapshot handling: Follower should be sending over an unparsed handle to the leader’s snapshot, which should only be deserialized when we are ready to apply it.
SnapshotManager is a rather messy affair. First of all it is implemented via scattered internal state which manipulated via SnapshotState implementations. This is a weird mix of a behaviours and forwarding objects, leading to really unmaintainable code.
Refactor SnapshotManager to carry polymorphic state object and integrate individual methods in a linear fashion, so that the code becomes clear without unnecessary indirections.
A second objective is to clean up the Follower/SnapshotManager interface w.r.t. InstallSnapshot handling: Follower should be sending over an unparsed handle to the leader’s snapshot, which should only be deserialized when we are ready to apply it.