Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Gateway ¶
type Gateway interface {
HandlerFuncs(auth func(w http.ResponseWriter, r *http.Request) bool) map[string]http.HandlerFunc
WaitUpgradeNotification()
Initialized() bool
DialFunc() client.DialFunc
Context() context.Context
NodeStore() client.NodeStore
TransferLeadership(ctx context.Context) error
DemoteOfflineNode(raftID uint64) error
Cancel()
ShutdownServer() error
Stop(connTimeout time.Duration) error
Sync()
Reset(networkCert tls.CertInfo) error
HeartbeatCancelFunc() func()
NetworkUpdateCert(cert tls.CertInfo)
WaitLeadership() error
LeaderAddress() (string, error)
HeartbeatRestart() bool
Node() db.Node
Cluster() db.Cluster
Initialize(bootstrap bool) error
CurrentRaftNodes(ctx context.Context) ([]db.RaftNode, error)
Options() *options.Options
HeartbeatOfflineThreshold() time.Duration
RaftDial() client.DialFunc
Standalone() bool
NetworkCert() tls.CertInfo
RaftNode() *db.RaftNode
SetRaftNode(n *db.RaftNode)
RaftClient(ctx context.Context) (*client.Client, error)
AwaitHeartbeat()
SetClusterDB(db.Cluster)
HeartbeatInterval() time.Duration
Heartbeat(ctx context.Context, m heartbeat.Mode)
SetHeartbeatOfflineThreshold(time.Duration)
SetHeartbeatNodeHook(f heartbeat.Hook)
State() state.State
ServerCert() tls.CertInfo
NewNotifier(ctx context.Context, networkCert tls.CertInfo, serverCert tls.CertInfo, policy NotifierPolicy) (Notifier, error)
IsLeader(ctx context.Context) (bool, error)
Driver(opts ...driver.Option) (*driver.Driver, error)
}
Gateway represents the cluster gateway implementation.
type Notifier ¶
type Notifier func(hook func(ctx context.Context, address string, networkCert, serverCert tls.CertInfo) error) []error
Notifier is a function that invokes the given function against each node in the cluster excluding the invoking one.
type NotifierPolicy ¶
type NotifierPolicy int
NotifierPolicy can be used to tweak the behavior of NewNotifier in case of some nodes are down.
const ( NotifyAll NotifierPolicy = iota // Requires that all nodes are up. NotifyAlive // Only notifies nodes that are alive NotifyTryAll // Attempt to notify all nodes regardless of state. )
Possible notification policies.
Click to show internal directories.
Click to hide internal directories.