aboutsummaryrefslogtreecommitdiff
path: root/weed/topology/cluster_commands.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2022-04-04 13:50:56 +0500
committerKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2022-04-04 13:50:56 +0500
commitc514710b7b0454c7a070ebf30aa865c9a5ad1591 (patch)
tree00df9926c66655ba554310aeb48ef4e0a313da3c /weed/topology/cluster_commands.go
parentdfe5bfbe2be0eed360ffcbdd1f25fa5a16a5eb55 (diff)
downloadseaweedfs-c514710b7b0454c7a070ebf30aa865c9a5ad1591.tar.xz
seaweedfs-c514710b7b0454c7a070ebf30aa865c9a5ad1591.zip
initial add hashicorp raft
Diffstat (limited to 'weed/topology/cluster_commands.go')
-rw-r--r--weed/topology/cluster_commands.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/weed/topology/cluster_commands.go b/weed/topology/cluster_commands.go
index 152691ccb..951de0711 100644
--- a/weed/topology/cluster_commands.go
+++ b/weed/topology/cluster_commands.go
@@ -1,9 +1,12 @@
package topology
import (
+ "encoding/json"
+ "fmt"
"github.com/chrislusf/raft"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
+ hashicorpRaft "github.com/hashicorp/raft"
)
type MaxVolumeIdCommand struct {
@@ -29,3 +32,19 @@ func (c *MaxVolumeIdCommand) Apply(server raft.Server) (interface{}, error) {
return nil, nil
}
+
+func (s *MaxVolumeIdCommand) Persist(sink hashicorpRaft.SnapshotSink) error {
+ b, err := json.Marshal(s)
+ if err != nil {
+ return fmt.Errorf("marshal: %v", err)
+ }
+ _, err = sink.Write(b)
+ if err != nil {
+ sink.Cancel()
+ return fmt.Errorf("sink.Write(): %v", err)
+ }
+ return sink.Close()
+}
+
+func (s *MaxVolumeIdCommand) Release() {
+}