-
-
Notifications
You must be signed in to change notification settings - Fork 60
Extract history logic to HistoryBuffer #385
Copy link
Copy link
Closed
Labels
refactorSame functionality with improved code qualitySame functionality with improved code quality
Description
Background
Currently, both state and input are stored in dictionaries that associate ticks with a second dictionary of property entry strings to values.
This history dictionary exists and is managed entirely in RollbackSynchronizer, by either directly manipulating the dictionary, or using _get_history().
To reduce the responsibilities of RollbackSynchronizer as described in #358, the point of this ticket is to extract the history management aspect of RollbackSynchronizer.
Done criteria
HistoryBufferis implemented- Tracks arbitrary data associated to ticks
set(tick, data)to associate data with a given tickhas(tick)to check if there is known data about the given tickfind_closest_tick(tick)to find the closest known tick ( the way_get_history()does )get_closest(tick, default = null)to get the data associated with the closest ticktrim(tick)to delete data before the specified tick. Should default to rollback history start.
PropertyHistoryBufferis implemented- Extends
HistoryBuffer, manages property entry dictionaries merge(tick, data)to merge incoming and known data
- Extends
RollbackSynchronizermanages state and input usingPropertyHistoryBuffers- Unit tests are added using
vest
Notes
- Getters and setters should not declare types in
HistoryBuffer, so thatPropertyHistoryBuffercan declare them without getting errors about differing signatures - Consider using ring buffers instead of dictionaries for storing data. Ideal would be to benchmark.
- Extracting states ( dictionary of property entry strings to values ) into its own class could also make sense, but possibly in a different issue. Open for discussion though.
- Include
RollbackFreshnessStorein the refactor, as it also stores tick-related data in the form of booleans.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
refactorSame functionality with improved code qualitySame functionality with improved code quality