mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
update raft
This commit is contained in:
parent
6fdff0bb18
commit
4511edc871
2
go.mod
2
go.mod
|
@ -84,7 +84,7 @@ require (
|
|||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/seaweedfs/goexif v1.0.3
|
||||
github.com/seaweedfs/raft v1.1.0
|
||||
github.com/seaweedfs/raft v1.1.2
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/spf13/afero v1.9.3 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1993,8 +1993,8 @@ github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24
|
|||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/seaweedfs/goexif v1.0.3 h1:ve/OjI7dxPW8X9YQsv3JuVMaxEyF9Rvfd04ouL+Bz30=
|
||||
github.com/seaweedfs/goexif v1.0.3/go.mod h1:Oni780Z236sXpIQzk1XoJlTwqrJ02smEin9zQeff7Fk=
|
||||
github.com/seaweedfs/raft v1.1.0 h1:Oy1mf3MzktDzNyXamD5lAZirLjEqPS7FzZoxLY0i8SU=
|
||||
github.com/seaweedfs/raft v1.1.0/go.mod h1:9cYlEBA+djJbnf/5tWsCybtbL7ICYpi+Uxcg3MxjuNs=
|
||||
github.com/seaweedfs/raft v1.1.2 h1:+p+mu/MWM83KoQOTUfsK1NOcPgt8wQtvFVslrHNcrkk=
|
||||
github.com/seaweedfs/raft v1.1.2/go.mod h1:9cYlEBA+djJbnf/5tWsCybtbL7ICYpi+Uxcg3MxjuNs=
|
||||
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
|
||||
github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
|
||||
github.com/secsy/goftp v0.0.0-20200609142545-aa2de14babf4 h1:PT+ElG/UUFMfqy5HrxJxNzj3QBOf7dZwupeVC+mG1Lo=
|
||||
|
|
|
@ -3,6 +3,7 @@ package weed_server
|
|||
import (
|
||||
"encoding/json"
|
||||
transport "github.com/Jille/raft-grpc-transport"
|
||||
"github.com/seaweedfs/raft/protobuf"
|
||||
"io"
|
||||
"math/rand"
|
||||
"os"
|
||||
|
@ -33,6 +34,8 @@ type RaftServerOption struct {
|
|||
}
|
||||
|
||||
type RaftServer struct {
|
||||
protobuf.UnimplementedRaftServer
|
||||
raftGrpcServer *raft.GrpcServer
|
||||
peers map[string]pb.ServerAddress // initial peers to join with
|
||||
raftServer raft.Server
|
||||
RaftHashicorp *hashicorpRaft.Raft
|
||||
|
@ -40,7 +43,6 @@ type RaftServer struct {
|
|||
dataDir string
|
||||
serverAddr pb.ServerAddress
|
||||
topo *topology.Topology
|
||||
*raft.GrpcServer
|
||||
}
|
||||
|
||||
type StateMachine struct {
|
||||
|
@ -162,7 +164,7 @@ func NewRaftServer(option *RaftServerOption) (*RaftServer, error) {
|
|||
}
|
||||
}
|
||||
|
||||
s.GrpcServer = raft.NewGrpcServer(s.raftServer)
|
||||
s.raftGrpcServer = raft.NewGrpcServer(s.raftServer)
|
||||
|
||||
glog.V(0).Infof("current cluster leader: %v", s.raftServer.Leader())
|
||||
|
||||
|
|
Loading…
Reference in a new issue