MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / Apply

Method Apply

lib/raft/raft_impl.go:46–64  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

44}
45
46func (i *Impl) Apply(b []byte) error {
47
48 // call the *Cluster.Apply method
49 af := i.m.Raft.Apply(b, 0)
50
51 // Error will only return generic errors related to raft
52 if err := af.Error(); err != nil {
53 return err
54 }
55
56 // *Cluster.Apply will return an error by Response, not by Error
57 // so here we must check whether the response is an error
58 response := af.Response()
59 if err, ok := response.(error); ok {
60 return err
61 }
62
63 return nil
64}
65
66func (i *Impl) AddServer(addr string) error {
67 return i.m.Raft.AddVoter(raft.ServerID(addr), raft.ServerAddress(addr), 0, 0).Error()

Callers

nothing calls this directly

Calls 1

ApplyMethod · 0.65

Tested by

no test coverage detected