mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-21 06:59:24 +08:00
Implemented RewriteLog functionality and defined handler for REWRITE AOF command.
This commit is contained in:
@@ -242,7 +242,8 @@ func (server *Server) Start(ctx context.Context) {
|
||||
} else {
|
||||
// Initialize standalone AOF engine
|
||||
server.AOFEngine = aof.NewAOFEngine(aof.Opts{
|
||||
Config: conf,
|
||||
Config: conf,
|
||||
GetState: server.GetState,
|
||||
})
|
||||
// Initialize and start standalone snapshot engine
|
||||
server.SnapshotEngine = snapshot.NewSnapshotEngine(snapshot.Opts{
|
||||
@@ -295,6 +296,11 @@ func (server *Server) GetLatestSnapshot() int64 {
|
||||
return server.LatestSnapshotMilliseconds.Load()
|
||||
}
|
||||
|
||||
func (server *Server) RewriteAOF() error {
|
||||
// TODO: Make this concurrent
|
||||
return server.AOFEngine.RewriteLog()
|
||||
}
|
||||
|
||||
func (server *Server) ShutDown(ctx context.Context) {
|
||||
if server.IsInCluster() {
|
||||
server.raft.RaftShutdown(ctx)
|
||||
|
Reference in New Issue
Block a user