feature: implement max log entries and replay per stream #162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
Been a happy user of this library for a couple of years and it works great! 😃
Something I've wanted and needed for a while is the ability to set a limit on the amount of events the event log can store, and being able to set if it should replay per stream and not globally.
This PR implements a new log store using container/list of the std library.
Along with that it adds the new method
CreateStreamWithOpts(id string, opts StreamOpts)
which takes aStreamOpts
config:The benefits of a new method is the backwards compatibility is kept.
When
MaxEntries
is set to a value greater than 0 it will check the length onAdd
, then remove the log at the back, and insert the new log event.go mod tidy
as well as updatedgolang.org/x/net
which was vulnerableHappy to take any feedback! And please let me know if this is something of interest at all. If not then I'll maintain a fork. 😄
If you think
container/list
is a bad idea, then we could possibly expose aLogStorer
interface and have that configurable by the user and keep the old implementation as default.