func (bs *boltStorage) saveSnap(snap raftpb.Snapshot) error {
	if raft.IsEmptySnap(snap) {
		return nil
	}

	tx, err := bs.db.Begin(true)
	if err != nil {
		return err
	}

	defer tx.Rollback()
	bites, err := proto.Marshal(&snap)
	if err != nil {
		return err
	}

	err = tx.Bucket(snapshotsBucket).Put(uint64ToBytes(snap.Metadata.Index), bites)
	if err != nil {
		return err
	}

	err = tx.Commit()
	if err != nil {
		return err
	}

	return nil
}
// Saves a raft snapshot by its index.
// An existing with the same index will be overridden.
Saves a raft snapshot by its index.
An existing with the same index will be overridden.
// Saves a raft snapshot by its index . // An existing with the same index will be overridden .
func (bs *boltStorage) saveSnap(snap raftpb.Snapshot) error {
	if raft.IsEmptySnap(snap) {
		return nil
	}
	tx, err := bs.db.Begin(true)
	if err != nil {
		return err
	}
	defer tx.Rollback()
	bites, err := proto.Marshal(&snap)
	if err != nil {
		return err
	}
	err = tx.Bucket(snapshotsBucket).Put(uint64ToBytes(snap.Metadata.Index), bites)
	if err != nil {
		return err
	}
	err = tx.Commit()
	if err != nil {
		return err
	}
	return nil
}
func ( bs * boltStorage ) saveSnap ( snap raftpb . Snapshot ) error { if raft . IsEmptySnap ( snap ) { return nil } tx , err := bs . db . Begin ( true ) if err != nil { return err } defer tx . Rollback ( ) bites , err := proto . Marshal ( & snap ) if err != nil { return err } err = tx . Bucket ( snapshotsBucket ) . Put ( uint64ToBytes ( snap . Metadata . Index ) , bites ) if err != nil { return err } err = tx . Commit ( ) if err != nil { return err } return nil }
Saves a raft snapshot by its index.
Saves a raft snapshot by its index .