-
Notifications
You must be signed in to change notification settings - Fork 271
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
Log interface decoupling #82
Comments
log's interface (and perhaps also callbacks) could be "closer" to what server wants. For instance, "get the term of an entry", "get a reference to a range of entries, including their data", "put a reference to a range of entries", etc. That would allow us to remove the circular buffer implementation and users to implement entry caching and referencing according their specific storage (possibly using hash tables, trees, etc., provided by other libraries). |
@liw what you describe is indeed very close to the design of the log store interface exposed by hashicorp's raft implementation (in Go). I'm porting a raft-based application from Go to C and not requiring all logs to be in memory all the time would be precisely the use case I have at hand. |
I like the idea of decoupling the log implementation a lot. I would first like to finish "batchifying" the log entry API (#51). This is because I don't want to specify a log entry API interface which will change immediately once we add batching APIs. |
There is already quite a lot of work in progress on this: Some observations and ideas moving forward:
|
@willemt this turned out to be a bigger deal than expected, with API changes leaking elsewhere but I think it's good progress. There's a branch that seems quite stable, tests passing etc. https://github.com/yossigo/raft/tree/feature/pluggable-log-impl |
Here's a major refactoring step to consider.
Currently the server logic and log implementation are quite coupled, to the point where the log implementation in many cases is responsible to trigger operations on the Raft side.
Decoupling would not just clean things up, but also make it possible to replace the log implementation. For example, it may be useful to implement a disk based log that does not require all entries to be in memory at all time and can fetch them from disk on demand.
The text was updated successfully, but these errors were encountered: