Documentation ¶
Index ¶
- Variables
- type AddNonvoterRequest
- type AddVoterRequest
- type AppliedIndexResponse
- type ApplyLogRequest
- type AwaitResponse
- type Client
- func (c *Client) AddNonvoter(ctx context.Context, target raft.ServerAddress, req *AddNonvoterRequest) (*AwaitResponse, error)
- func (c *Client) AddVoter(ctx context.Context, target raft.ServerAddress, req *AddVoterRequest) (*AwaitResponse, error)
- func (c *Client) AppliedIndex(ctx context.Context, target raft.ServerAddress) (*AppliedIndexResponse, error)
- func (c *Client) ApplyLog(ctx context.Context, target raft.ServerAddress, req *ApplyLogRequest) (*AwaitResponse, error)
- func (c *Client) Barrier(ctx context.Context, target raft.ServerAddress) (*AwaitResponse, error)
- func (c *Client) DemoteVoter(ctx context.Context, target raft.ServerAddress, req *DemoteVoterRequest) (*AwaitResponse, error)
- func (c *Client) GetConfiguration(ctx context.Context, target raft.ServerAddress) (*GetConfigurationResponse, error)
- func (c *Client) LastContact(ctx context.Context, target raft.ServerAddress) (*LastContactResponse, error)
- func (c *Client) LastIndex(ctx context.Context, target raft.ServerAddress) (*LastIndexResponse, error)
- func (c *Client) Leader(ctx context.Context, target raft.ServerAddress) (*LeaderResponse, error)
- func (c *Client) LeadershipTransfer(ctx context.Context, target raft.ServerAddress, ...) (*AwaitResponse, error)
- func (c *Client) RemoveServer(ctx context.Context, target raft.ServerAddress, req *RemoveServerRequest) (*AwaitResponse, error)
- func (c *Client) Shutdown(ctx context.Context, target raft.ServerAddress) (*AwaitResponse, error)
- func (c *Client) State(ctx context.Context, target raft.ServerAddress) (*StateResponse, error)
- func (c *Client) Stats(ctx context.Context, target raft.ServerAddress) (*StatsResponse, error)
- func (c *Client) VerifyLeader(ctx context.Context, target raft.ServerAddress) error
- type DemoteVoterRequest
- type Doer
- type ForgetResponse
- type Future
- type GetConfigurationResponse
- type GetConfigurationServer
- type LastContactResponse
- type LastIndexResponse
- type LeaderResponse
- type LeadershipTransferToServerRequest
- type RaftState
- type RaftSuffrage
- type RemoveServerRequest
- type Server
- func (a *Server) AddNonvoter(ctx context.Context, req *AddNonvoterRequest) (*Future, error)
- func (a *Server) AddVoter(ctx context.Context, req *AddVoterRequest) (*Future, error)
- func (a *Server) AppliedIndex(ctx context.Context) (*AppliedIndexResponse, error)
- func (a *Server) Await(ctx context.Context, req *Future) (*AwaitResponse, error)
- func (a *Server) Barrier(ctx context.Context) (*Future, error)
- func (a *Server) CurrentNodeIsLeader(ctx context.Context) bool
- func (a *Server) DemoteVoter(ctx context.Context, req *DemoteVoterRequest) (*Future, error)
- func (a *Server) Forget(ctx context.Context, req *Future) (*ForgetResponse, error)
- func (a *Server) GetConfiguration(ctx context.Context) (*GetConfigurationResponse, error)
- func (a *Server) LastContact(ctx context.Context) (*LastContactResponse, error)
- func (a *Server) LastIndex(ctx context.Context) (*LastIndexResponse, error)
- func (a *Server) Leader(ctx context.Context) (*LeaderResponse, error)
- func (a *Server) LeadershipTransfer(ctx context.Context) (*Future, error)
- func (a *Server) LeadershipTransferToServer(ctx context.Context, req *LeadershipTransferToServerRequest) (*Future, error)
- func (a *Server) RemoveServer(ctx context.Context, req *RemoveServerRequest) (*Future, error)
- func (t *Server) ServeHTTP(res http.ResponseWriter, req *http.Request)
- func (a *Server) Shutdown(ctx context.Context) (*Future, error)
- func (a *Server) Snapshot(ctx context.Context) (*Future, error)
- func (a *Server) State(ctx context.Context) (*StateResponse, error)
- func (a *Server) Stats(ctx context.Context) (*StatsResponse, error)
- func (a *Server) VerifyLeader(ctx context.Context) (*Future, error)
- type StateResponse
- type StatsResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotLeader = errors.New("not leader")
Functions ¶
This section is empty.
Types ¶
type AddNonvoterRequest ¶
type AddVoterRequest ¶
type AppliedIndexResponse ¶
type AppliedIndexResponse struct {
Index uint64 `json:"index"`
}
type ApplyLogRequest ¶
type AwaitResponse ¶
type Client ¶ added in v0.11.0
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddNonvoter ¶ added in v0.11.0
func (c *Client) AddNonvoter(ctx context.Context, target raft.ServerAddress, req *AddNonvoterRequest) (*AwaitResponse, error)
func (*Client) AddVoter ¶ added in v0.11.0
func (c *Client) AddVoter(ctx context.Context, target raft.ServerAddress, req *AddVoterRequest) (*AwaitResponse, error)
func (*Client) AppliedIndex ¶ added in v0.11.0
func (c *Client) AppliedIndex(ctx context.Context, target raft.ServerAddress) (*AppliedIndexResponse, error)
func (*Client) ApplyLog ¶ added in v0.11.0
func (c *Client) ApplyLog(ctx context.Context, target raft.ServerAddress, req *ApplyLogRequest) (*AwaitResponse, error)
func (*Client) Barrier ¶ added in v0.11.0
func (c *Client) Barrier(ctx context.Context, target raft.ServerAddress) (*AwaitResponse, error)
func (*Client) DemoteVoter ¶ added in v0.11.0
func (c *Client) DemoteVoter(ctx context.Context, target raft.ServerAddress, req *DemoteVoterRequest) (*AwaitResponse, error)
func (*Client) GetConfiguration ¶ added in v0.11.0
func (c *Client) GetConfiguration(ctx context.Context, target raft.ServerAddress) (*GetConfigurationResponse, error)
func (*Client) LastContact ¶ added in v0.11.0
func (c *Client) LastContact(ctx context.Context, target raft.ServerAddress) (*LastContactResponse, error)
func (*Client) LastIndex ¶ added in v0.11.0
func (c *Client) LastIndex(ctx context.Context, target raft.ServerAddress) (*LastIndexResponse, error)
func (*Client) Leader ¶ added in v0.11.0
func (c *Client) Leader(ctx context.Context, target raft.ServerAddress) (*LeaderResponse, error)
func (*Client) LeadershipTransfer ¶ added in v0.11.0
func (c *Client) LeadershipTransfer(ctx context.Context, target raft.ServerAddress, req *LeadershipTransferToServerRequest) (*AwaitResponse, error)
func (*Client) RemoveServer ¶ added in v0.11.0
func (c *Client) RemoveServer(ctx context.Context, target raft.ServerAddress, req *RemoveServerRequest) (*AwaitResponse, error)
func (*Client) Shutdown ¶ added in v0.11.0
func (c *Client) Shutdown(ctx context.Context, target raft.ServerAddress) (*AwaitResponse, error)
func (*Client) State ¶ added in v0.11.0
func (c *Client) State(ctx context.Context, target raft.ServerAddress) (*StateResponse, error)
func (*Client) Stats ¶ added in v0.11.0
func (c *Client) Stats(ctx context.Context, target raft.ServerAddress) (*StatsResponse, error)
func (*Client) VerifyLeader ¶ added in v0.11.0
type DemoteVoterRequest ¶
type ForgetResponse ¶
type ForgetResponse struct {
OperationToken string `json:"operation_token"`
}
type GetConfigurationResponse ¶
type GetConfigurationResponse struct {
Servers []*GetConfigurationServer `json:"servers"`
}
type GetConfigurationServer ¶
type GetConfigurationServer struct { Suffrage RaftSuffrage `json:"suffrage"` ID string `json:"id"` Address string `json:"address"` }
type LastContactResponse ¶
type LastContactResponse struct {
UnixNano int64 `json:"unix_nano"`
}
type LastIndexResponse ¶
type LastIndexResponse struct {
Index uint64 `json:"index"`
}
type LeaderResponse ¶
type RaftSuffrage ¶
type RaftSuffrage string
const ( RaftSuffrageVoter RaftSuffrage = "voter" RaftSuffrageNonvoter RaftSuffrage = "nonvoter" )
type RemoveServerRequest ¶
type Server ¶ added in v0.11.0
type Server struct {
// contains filtered or unexported fields
}
Server provides a HTTP-based transport that can be used to communicate with Raft on remote machines. It is convenient to use if your application is an HTTP server already and you do not want to use multiple different transports (if not, you can use raft.NetworkTransport).
func (*Server) AddNonvoter ¶ added in v0.11.0
func (*Server) AppliedIndex ¶ added in v0.11.0
func (a *Server) AppliedIndex(ctx context.Context) (*AppliedIndexResponse, error)
func (*Server) CurrentNodeIsLeader ¶ added in v0.11.0
func (*Server) DemoteVoter ¶ added in v0.11.0
func (*Server) GetConfiguration ¶ added in v0.11.0
func (a *Server) GetConfiguration(ctx context.Context) (*GetConfigurationResponse, error)
func (*Server) LastContact ¶ added in v0.11.0
func (a *Server) LastContact(ctx context.Context) (*LastContactResponse, error)
func (*Server) LastIndex ¶ added in v0.11.0
func (a *Server) LastIndex(ctx context.Context) (*LastIndexResponse, error)
func (*Server) Leader ¶ added in v0.11.0
func (a *Server) Leader(ctx context.Context) (*LeaderResponse, error)
func (*Server) LeadershipTransfer ¶ added in v0.11.0
func (*Server) LeadershipTransferToServer ¶ added in v0.11.0
func (*Server) RemoveServer ¶ added in v0.11.0
func (*Server) ServeHTTP ¶ added in v0.11.0
func (t *Server) ServeHTTP(res http.ResponseWriter, req *http.Request)
ServeHTTP implements the net/http.Handler interface, so that you can use
func (*Server) State ¶ added in v0.11.0
func (a *Server) State(ctx context.Context) (*StateResponse, error)
type StateResponse ¶
type StatsResponse ¶
Click to show internal directories.
Click to hide internal directories.