Documentation ¶
Index ¶
Constants ¶
const ( // PublicEndpoint - Internally managed APIs. PublicEndpoint types.EndpointPrefix = "core/1.0" // InternalEndpoint - All internal endpoints restricted to trusted servers. InternalEndpoint types.EndpointPrefix = "core/internal" // ControlEndpoint - All internal endpoints available on the local unix socket. ControlEndpoint types.EndpointPrefix = "core/control" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Control ¶
type Control struct { Bootstrap bool `json:"bootstrap" yaml:"bootstrap"` InitConfig map[string]string `json:"config" yaml:"config"` JoinToken string `json:"join_token" yaml:"join_token"` Address types.AddrPort `json:"address" yaml:"address"` Name string `json:"name" yaml:"name"` }
Control represents the arguments that can be used to initialize/shutdown the daemon.
type HeartbeatInfo ¶
type HeartbeatInfo struct { BeginRound bool `json:"begin_round" yaml:"begin_round"` MaxSchemaInternal uint64 `json:"max_schema_internal" yaml:"max_schema_internal"` MaxSchemaExternal uint64 `json:"max_schema_external" yaml:"max_schema_external"` ClusterMembers map[string]types.ClusterMember `json:"cluster_members" yaml:"cluster_members"` LeaderAddress string `json:"leader_address" yaml:"leader_address"` DqliteRoles map[string]string `json:"dqlite_roles" yaml:"dqlite_roles"` }
HeartbeatInfo represents information about the cluster sent out by the leader of the cluster to other members. If BeginRound is set, a new heartbeat will initiate.
type HookNewMemberOptions ¶
type HookNewMemberOptions struct { // Name is the name of the new cluster member that joined the cluster, triggering this hook. NewMember types.ClusterMemberLocal `json:"new_member" yaml:"new_member"` }
HookNewMemberOptions holds configuration pertaining to the OnNewMember hook.
type HookRemoveMemberOptions ¶
type HookRemoveMemberOptions struct { // Force represents whether to run the hook with the `force` option. Force bool `json:"force" yaml:"force"` }
HookRemoveMemberOptions holds configuration pertaining to the PreRemove and PostRemove hooks.
type HookType ¶
type HookType string
HookType represents the various types of hooks available to microcluster.
const ( // OnStart is run after the daemon is started. OnStart HookType = "on-start" // PreBootstrap is run before the daemon is initialized and bootstrapped. PreBootstrap HookType = "pre-bootstrap" // PostBootstrap is run after the daemon is initialized and bootstrapped. PostBootstrap HookType = "post-bootstrap" // PreJoin is run after the daemon is initialized and joined the cluster but before existing members triggered // their 'OnNewMember' hooks. PreJoin HookType = "pre-join" // PostJoin is run after the daemon is initialized, joined the cluster and existing members triggered // their 'OnNewMember' hooks. PostJoin HookType = "post-join" // PreRemove is run on a cluster member just before it is removed from the cluster. PreRemove HookType = "pre-remove" // PostRemove is run on all other peers after one is removed from the cluster. PostRemove HookType = "post-remove" // OnNewMember is run on each peer after a new cluster member has joined and executed their 'PreJoin' hook. OnNewMember HookType = "on-new-member" // OnHeartbeat is run after a successful heartbeat round. OnHeartbeat HookType = "on-heartbeat" // OnDaemonConfigUpdate is run after the local daemon received a config update. OnDaemonConfigUpdate HookType = "on-daemon-config-update" )
type SQLBatch ¶
type SQLBatch struct {
Results []SQLResult
}
SQLBatch represents a batch of SQL results.
type SQLDump ¶
type SQLDump struct {
Text string `json:"text" yaml:"text"`
}
SQLDump represents the text of a SQL dump.
type SQLQuery ¶
type SQLQuery struct {
Query string `json:"query" yaml:"query"`
}
SQLQuery represents a SQL query.
type SQLResult ¶
type SQLResult struct { Type string `json:"type" yaml:"type"` Columns []string `json:"columns" yaml:"columns"` Rows [][]any `json:"rows" yaml:"rows"` RowsAffected int64 `json:"rows_affected" yaml:"rows_affected"` }
SQLResult represents the result of executing a SQL command.
type Server ¶
type Server struct { Name string `json:"name" yaml:"name"` Address types.AddrPort `json:"address" yaml:"address"` Version string `json:"version" yaml:"version"` Ready bool `json:"ready" yaml:"ready"` Extensions extensions.Extensions `json:"extensions" yaml:"extensions"` }
Server represents server status information.
type Token ¶
type Token struct { // Secret is the underlying secret string used to authenticate the token. Secret string `json:"secret" yaml:"secret"` // Fingerprint is the fingerprint of the cluster certificate, // so that the joiner can verify that the public key of the cluster matches this request. Fingerprint string `json:"fingerprint" yaml:"fingerprint"` // JoinAddresses is the list of addresses of the existing cluster members that the joiner may supply the token to. // Internally, the first system to accept the token will forward it to the dqlite leader. JoinAddresses []types.AddrPort `json:"join_addresses" yaml:"join_addresses"` }
Token holds the information that is presented to the joining node when requesting a token.
func DecodeToken ¶
DecodeToken decodes a base64-encoded token string.
type TokenRecord ¶
type TokenRecord struct { Name string `json:"name" yaml:"name"` Token string `json:"token" yaml:"token"` ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"` }
TokenRecord represents the internal record of a join token.
type TokenRequest ¶
type TokenRequest struct { Name string `json:"name" yaml:"name"` ExpireAfter time.Duration `json:"expire_after" yaml:"expire_after"` }
TokenRequest holds information for requesting a join token.
type TokenResponse ¶
type TokenResponse struct { // ClusterCert is the public key used across the cluster. ClusterCert types.X509Certificate `json:"cluster_cert" yaml:"cluster_cert"` // ClusterKey is the private key used across the cluster. ClusterKey string `json:"cluster_key" yaml:"cluster_key"` // ClusterMembers is the full list of cluster members that are currently present and available in the cluster. // The joiner supplies this list to dqlite so that it can start its database. ClusterMembers []types.ClusterMemberLocal `json:"cluster_members" yaml:"cluster_members"` // ClusterAdditionalCerts is the full list of certificates added for additional listeners. ClusterAdditionalCerts map[string]types.KeyPair // TrustedMember contains the address of the existing cluster member // who was dqlite leader at the time that the joiner supplied its join token. // // The trusted member will have already recorded the joiner's information in // its local truststore, and thus will trust requests from the joiner prior to fully joining. TrustedMember types.ClusterMemberLocal `json:"trusted_member" yaml:"trusted_member"` }
TokenResponse holds the information for connecting to a cluster by a node with a valid join token.