add snapshot

This commit is contained in:
Xiang Li
2013-08-10 23:37:26 -07:00
parent 64eeca3941
commit 434b0045db
4 changed files with 13 additions and 12 deletions

View File

@ -1025,16 +1025,7 @@ func (s *Server) RemovePeer(name string) error {
// Log compaction
//--------------------------------------
// The background snapshot function
func (s *Server) Snapshot() {
for {
// TODO: change this... to something reasonable
time.Sleep(1 * time.Second)
s.takeSnapshot()
}
}
func (s *Server) takeSnapshot() error {
func (s *Server) TakeSnapshot() error {
//TODO put a snapshot mutex
s.debugln("take Snapshot")
if s.currentSnapshot != nil {