mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-21 06:59:24 +08:00
Created basic handling for taking snapshots. Will implemented error when snapshot in progress and propagation of snapshot command to the rest of the cluster
This commit is contained in:
@@ -240,6 +240,15 @@ func (server *Server) Start(ctx context.Context) {
|
||||
server.StartTCP(ctx)
|
||||
}
|
||||
|
||||
func (server *Server) TakeSnapshot() error {
|
||||
// TODO: Check if there's a snapshot currently in progress
|
||||
go func() {
|
||||
err := server.raft.TakeSnapshot()
|
||||
log.Println(err)
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (server *Server) ShutDown(ctx context.Context) {
|
||||
if server.IsInCluster() {
|
||||
server.raft.RaftShutdown(ctx)
|
||||
|
Reference in New Issue
Block a user