Documentation ¶
Index ¶
- Variables
- type AddNonvoterRequest
- type AddVoterRequest
- type AppliedIndexResponse
- type ApplyLogRequest
- type AwaitResponse
- type DemoteVoterRequest
- type Doer
- type ForgetResponse
- type Future
- type GetConfigurationResponse
- type GetConfigurationServer
- type HTTPAdminClient
- func (c *HTTPAdminClient) AddNonvoter(ctx context.Context, target raft.ServerAddress, req *AddNonvoterRequest) (*AwaitResponse, error)
- func (c *HTTPAdminClient) AddVoter(ctx context.Context, target raft.ServerAddress, req *AddVoterRequest) (*AwaitResponse, error)
- func (c *HTTPAdminClient) AppliedIndex(ctx context.Context, target raft.ServerAddress) (*AppliedIndexResponse, error)
- func (c *HTTPAdminClient) ApplyLog(ctx context.Context, target raft.ServerAddress, req *ApplyLogRequest) (*AwaitResponse, error)
- func (c *HTTPAdminClient) Barrier(ctx context.Context, target raft.ServerAddress) (*AwaitResponse, error)
- func (c *HTTPAdminClient) DemoteVoter(ctx context.Context, target raft.ServerAddress, req *DemoteVoterRequest) (*AwaitResponse, error)
- func (c *HTTPAdminClient) GetConfiguration(ctx context.Context, target raft.ServerAddress) (*GetConfigurationResponse, error)
- func (c *HTTPAdminClient) LastContact(ctx context.Context, target raft.ServerAddress) (*LastContactResponse, error)
- func (c *HTTPAdminClient) LastIndex(ctx context.Context, target raft.ServerAddress) (*LastIndexResponse, error)
- func (c *HTTPAdminClient) Leader(ctx context.Context, target raft.ServerAddress) (*LeaderResponse, error)
- func (c *HTTPAdminClient) LeadershipTransfer(ctx context.Context, target raft.ServerAddress, ...) (*AwaitResponse, error)
- func (c *HTTPAdminClient) RemoveServer(ctx context.Context, target raft.ServerAddress, req *RemoveServerRequest) (*AwaitResponse, error)
- func (c *HTTPAdminClient) Shutdown(ctx context.Context, target raft.ServerAddress) (*AwaitResponse, error)
- func (c *HTTPAdminClient) State(ctx context.Context, target raft.ServerAddress) (*StateResponse, error)
- func (c *HTTPAdminClient) Stats(ctx context.Context, target raft.ServerAddress) (*StatsResponse, error)
- func (c *HTTPAdminClient) VerifyLeader(ctx context.Context, target raft.ServerAddress) error
- type LastContactResponse
- type LastIndexResponse
- type LeaderResponse
- type LeadershipTransferToServerRequest
- type RaftAdminHTTPServer
- func (a *RaftAdminHTTPServer) AddNonvoter(ctx context.Context, req *AddNonvoterRequest) (*Future, error)
- func (a *RaftAdminHTTPServer) AddVoter(ctx context.Context, req *AddVoterRequest) (*Future, error)
- func (a *RaftAdminHTTPServer) AppliedIndex(ctx context.Context) (*AppliedIndexResponse, error)
- func (a *RaftAdminHTTPServer) Await(ctx context.Context, req *Future) (*AwaitResponse, error)
- func (a *RaftAdminHTTPServer) Barrier(ctx context.Context) (*Future, error)
- func (a *RaftAdminHTTPServer) CurrentNodeIsLeader(ctx context.Context) bool
- func (a *RaftAdminHTTPServer) DemoteVoter(ctx context.Context, req *DemoteVoterRequest) (*Future, error)
- func (a *RaftAdminHTTPServer) Forget(ctx context.Context, req *Future) (*ForgetResponse, error)
- func (a *RaftAdminHTTPServer) GetConfiguration(ctx context.Context) (*GetConfigurationResponse, error)
- func (a *RaftAdminHTTPServer) LastContact(ctx context.Context) (*LastContactResponse, error)
- func (a *RaftAdminHTTPServer) LastIndex(ctx context.Context) (*LastIndexResponse, error)
- func (a *RaftAdminHTTPServer) Leader(ctx context.Context) (*LeaderResponse, error)
- func (a *RaftAdminHTTPServer) LeadershipTransfer(ctx context.Context) (*Future, error)
- func (a *RaftAdminHTTPServer) LeadershipTransferToServer(ctx context.Context, req *LeadershipTransferToServerRequest) (*Future, error)
- func (a *RaftAdminHTTPServer) RemoveServer(ctx context.Context, req *RemoveServerRequest) (*Future, error)
- func (t *RaftAdminHTTPServer) ServeHTTP(res http.ResponseWriter, req *http.Request)
- func (a *RaftAdminHTTPServer) Shutdown(ctx context.Context) (*Future, error)
- func (a *RaftAdminHTTPServer) Snapshot(ctx context.Context) (*Future, error)
- func (a *RaftAdminHTTPServer) State(ctx context.Context) (*StateResponse, error)
- func (a *RaftAdminHTTPServer) Stats(ctx context.Context) (*StatsResponse, error)
- func (a *RaftAdminHTTPServer) VerifyLeader(ctx context.Context) (*Future, error)
- type RaftState
- type RaftSuffrage
- type RemoveServerRequest
- 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 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 HTTPAdminClient ¶
type HTTPAdminClient struct {
// contains filtered or unexported fields
}
func NewHTTPAdminClient ¶
func NewHTTPAdminClient(doer Doer, urlFmt string, logger *zap.Logger) *HTTPAdminClient
func (*HTTPAdminClient) AddNonvoter ¶
func (c *HTTPAdminClient) AddNonvoter(ctx context.Context, target raft.ServerAddress, req *AddNonvoterRequest) (*AwaitResponse, error)
func (*HTTPAdminClient) AddVoter ¶
func (c *HTTPAdminClient) AddVoter(ctx context.Context, target raft.ServerAddress, req *AddVoterRequest) (*AwaitResponse, error)
func (*HTTPAdminClient) AppliedIndex ¶
func (c *HTTPAdminClient) AppliedIndex(ctx context.Context, target raft.ServerAddress) (*AppliedIndexResponse, error)
func (*HTTPAdminClient) ApplyLog ¶
func (c *HTTPAdminClient) ApplyLog(ctx context.Context, target raft.ServerAddress, req *ApplyLogRequest) (*AwaitResponse, error)
func (*HTTPAdminClient) Barrier ¶
func (c *HTTPAdminClient) Barrier(ctx context.Context, target raft.ServerAddress) (*AwaitResponse, error)
func (*HTTPAdminClient) DemoteVoter ¶
func (c *HTTPAdminClient) DemoteVoter(ctx context.Context, target raft.ServerAddress, req *DemoteVoterRequest) (*AwaitResponse, error)
func (*HTTPAdminClient) GetConfiguration ¶
func (c *HTTPAdminClient) GetConfiguration(ctx context.Context, target raft.ServerAddress) (*GetConfigurationResponse, error)
func (*HTTPAdminClient) LastContact ¶
func (c *HTTPAdminClient) LastContact(ctx context.Context, target raft.ServerAddress) (*LastContactResponse, error)
func (*HTTPAdminClient) LastIndex ¶
func (c *HTTPAdminClient) LastIndex(ctx context.Context, target raft.ServerAddress) (*LastIndexResponse, error)
func (*HTTPAdminClient) Leader ¶
func (c *HTTPAdminClient) Leader(ctx context.Context, target raft.ServerAddress) (*LeaderResponse, error)
func (*HTTPAdminClient) LeadershipTransfer ¶
func (c *HTTPAdminClient) LeadershipTransfer(ctx context.Context, target raft.ServerAddress, req *LeadershipTransferToServerRequest) (*AwaitResponse, error)
func (*HTTPAdminClient) RemoveServer ¶
func (c *HTTPAdminClient) RemoveServer(ctx context.Context, target raft.ServerAddress, req *RemoveServerRequest) (*AwaitResponse, error)
func (*HTTPAdminClient) Shutdown ¶
func (c *HTTPAdminClient) Shutdown(ctx context.Context, target raft.ServerAddress) (*AwaitResponse, error)
func (*HTTPAdminClient) State ¶
func (c *HTTPAdminClient) State(ctx context.Context, target raft.ServerAddress) (*StateResponse, error)
func (*HTTPAdminClient) Stats ¶
func (c *HTTPAdminClient) Stats(ctx context.Context, target raft.ServerAddress) (*StatsResponse, error)
func (*HTTPAdminClient) VerifyLeader ¶
func (c *HTTPAdminClient) VerifyLeader(ctx context.Context, target raft.ServerAddress) error
type LastContactResponse ¶
type LastContactResponse struct {
UnixNano int64 `json:"unix_nano"`
}
type LastIndexResponse ¶
type LastIndexResponse struct {
Index uint64 `json:"index"`
}
type LeaderResponse ¶
type RaftAdminHTTPServer ¶
type RaftAdminHTTPServer struct {
// contains filtered or unexported fields
}
RaftAdminHTTPServer 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 NewRaftAdminHTTPServer ¶
func NewRaftAdminHTTPServer(r *raft.Raft, logger *zap.Logger, addrs []raft.ServerAddress) *RaftAdminHTTPServer
NewRaftAdminHTTPServer creates a new HTTP transport on the given addr.
func (*RaftAdminHTTPServer) AddNonvoter ¶
func (a *RaftAdminHTTPServer) AddNonvoter(ctx context.Context, req *AddNonvoterRequest) (*Future, error)
func (*RaftAdminHTTPServer) AddVoter ¶
func (a *RaftAdminHTTPServer) AddVoter(ctx context.Context, req *AddVoterRequest) (*Future, error)
func (*RaftAdminHTTPServer) AppliedIndex ¶
func (a *RaftAdminHTTPServer) AppliedIndex(ctx context.Context) (*AppliedIndexResponse, error)
func (*RaftAdminHTTPServer) Await ¶
func (a *RaftAdminHTTPServer) Await(ctx context.Context, req *Future) (*AwaitResponse, error)
func (*RaftAdminHTTPServer) Barrier ¶
func (a *RaftAdminHTTPServer) Barrier(ctx context.Context) (*Future, error)
func (*RaftAdminHTTPServer) CurrentNodeIsLeader ¶
func (a *RaftAdminHTTPServer) CurrentNodeIsLeader(ctx context.Context) bool
func (*RaftAdminHTTPServer) DemoteVoter ¶
func (a *RaftAdminHTTPServer) DemoteVoter(ctx context.Context, req *DemoteVoterRequest) (*Future, error)
func (*RaftAdminHTTPServer) Forget ¶
func (a *RaftAdminHTTPServer) Forget(ctx context.Context, req *Future) (*ForgetResponse, error)
func (*RaftAdminHTTPServer) GetConfiguration ¶
func (a *RaftAdminHTTPServer) GetConfiguration(ctx context.Context) (*GetConfigurationResponse, error)
func (*RaftAdminHTTPServer) LastContact ¶
func (a *RaftAdminHTTPServer) LastContact(ctx context.Context) (*LastContactResponse, error)
func (*RaftAdminHTTPServer) LastIndex ¶
func (a *RaftAdminHTTPServer) LastIndex(ctx context.Context) (*LastIndexResponse, error)
func (*RaftAdminHTTPServer) Leader ¶
func (a *RaftAdminHTTPServer) Leader(ctx context.Context) (*LeaderResponse, error)
func (*RaftAdminHTTPServer) LeadershipTransfer ¶
func (a *RaftAdminHTTPServer) LeadershipTransfer(ctx context.Context) (*Future, error)
func (*RaftAdminHTTPServer) LeadershipTransferToServer ¶
func (a *RaftAdminHTTPServer) LeadershipTransferToServer(ctx context.Context, req *LeadershipTransferToServerRequest) (*Future, error)
func (*RaftAdminHTTPServer) RemoveServer ¶
func (a *RaftAdminHTTPServer) RemoveServer(ctx context.Context, req *RemoveServerRequest) (*Future, error)
func (*RaftAdminHTTPServer) ServeHTTP ¶
func (t *RaftAdminHTTPServer) ServeHTTP(res http.ResponseWriter, req *http.Request)
ServeHTTP implements the net/http.Handler interface, so that you can use
func (*RaftAdminHTTPServer) Shutdown ¶
func (a *RaftAdminHTTPServer) Shutdown(ctx context.Context) (*Future, error)
func (*RaftAdminHTTPServer) Snapshot ¶
func (a *RaftAdminHTTPServer) Snapshot(ctx context.Context) (*Future, error)
func (*RaftAdminHTTPServer) State ¶
func (a *RaftAdminHTTPServer) State(ctx context.Context) (*StateResponse, error)
func (*RaftAdminHTTPServer) Stats ¶
func (a *RaftAdminHTTPServer) Stats(ctx context.Context) (*StatsResponse, error)
func (*RaftAdminHTTPServer) VerifyLeader ¶
func (a *RaftAdminHTTPServer) VerifyLeader(ctx context.Context) (*Future, error)
type RaftSuffrage ¶
type RaftSuffrage string
const ( RaftSuffrageVoter RaftSuffrage = "voter" RaftSuffrageNonvoter RaftSuffrage = "nonvoter" )
type RemoveServerRequest ¶
type StateResponse ¶
type StatsResponse ¶
Click to show internal directories.
Click to hide internal directories.