Documentation ¶
Index ¶
- func CoreClusterMemberExists(ctx context.Context, tx *sql.Tx, name string) (bool, error)
- func CoreTokenRecordExists(ctx context.Context, tx *sql.Tx, secret string) (bool, error)
- func CreateCoreClusterMember(ctx context.Context, tx *sql.Tx, object CoreClusterMember) (int64, error)
- func CreateCoreTokenRecord(ctx context.Context, tx *sql.Tx, object CoreTokenRecord) (int64, error)
- func DeleteCoreClusterMember(ctx context.Context, tx *sql.Tx, address string) error
- func DeleteCoreTokenRecord(ctx context.Context, tx *sql.Tx, name string) error
- func DeleteExpiredCoreTokenRecords(ctx context.Context, tx *sql.Tx) error
- func GetCallerProject() string
- func GetCoreClusterMemberID(ctx context.Context, tx *sql.Tx, name string) (int64, error)
- func GetCoreTokenRecordID(ctx context.Context, tx *sql.Tx, secret string) (int64, error)
- func PrepareStmts(db *sql.DB, project string, skipErrors bool) error
- func RegisterStmt(sql string) int
- func Stmt(tx *sql.Tx, code int) (*sql.Stmt, error)
- func StmtString(code int) (string, error)
- func UpdateCoreClusterMember(ctx context.Context, tx *sql.Tx, name string, object CoreClusterMember) error
- type CoreClusterMember
- func GetCoreClusterMember(ctx context.Context, tx *sql.Tx, name string) (*CoreClusterMember, error)
- func GetCoreClusterMembers(ctx context.Context, tx *sql.Tx, filters ...CoreClusterMemberFilter) ([]CoreClusterMember, error)
- func GetUpgradingClusterMembers(ctx context.Context, tx *sql.Tx, schemaInternal uint64, schemaExternal uint64, ...) (allMembers []CoreClusterMember, awaitingMembers map[string]bool, err error)
- type CoreClusterMemberFilter
- type CoreTokenRecord
- type CoreTokenRecordFilter
- type DqliteMember
- type Role
- type Schema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CoreClusterMemberExists ¶
CoreClusterMemberExists checks if a core_cluster_member with the given key exists. generator: core_cluster_member Exists
func CoreTokenRecordExists ¶
CoreTokenRecordExists checks if a core_token_record with the given key exists. generator: core_token_record Exists
func CreateCoreClusterMember ¶
func CreateCoreClusterMember(ctx context.Context, tx *sql.Tx, object CoreClusterMember) (int64, error)
CreateCoreClusterMember adds a new core_cluster_member to the database. generator: core_cluster_member Create
func CreateCoreTokenRecord ¶
CreateCoreTokenRecord adds a new core_token_record to the database. generator: core_token_record Create
func DeleteCoreClusterMember ¶
DeleteCoreClusterMember deletes the core_cluster_member matching the given key parameters. generator: core_cluster_member DeleteOne-by-Address
func DeleteCoreTokenRecord ¶
DeleteCoreTokenRecord deletes the core_token_record matching the given key parameters. generator: core_token_record DeleteOne-by-Name
func DeleteExpiredCoreTokenRecords ¶
DeleteExpiredCoreTokenRecords cleans up expired tokens.
func GetCallerProject ¶
func GetCallerProject() string
GetCallerProject will get the go project name of whichever function called `GetCallerProject`.
func GetCoreClusterMemberID ¶
GetCoreClusterMemberID return the ID of the core_cluster_member with the given key. generator: core_cluster_member ID
func GetCoreTokenRecordID ¶
GetCoreTokenRecordID return the ID of the core_token_record with the given key. generator: core_token_record ID
func PrepareStmts ¶
PrepareStmts prepares all registered statements and stores them in preparedStmts.
func RegisterStmt ¶
RegisterStmt register a SQL statement.
Registered statements will be prepared upfront and re-used, to speed up execution.
Return a unique registration code.
func StmtString ¶
StmtString returns the in-memory query string with the given code.
func UpdateCoreClusterMember ¶
func UpdateCoreClusterMember(ctx context.Context, tx *sql.Tx, name string, object CoreClusterMember) error
UpdateCoreClusterMember updates the core_cluster_member matching the given key parameters. generator: core_cluster_member Update
Types ¶
type CoreClusterMember ¶
type CoreClusterMember struct { ID int Name string `db:"primary=yes"` Address string Certificate string SchemaInternal uint64 SchemaExternal uint64 APIExtensions extensions.Extensions Heartbeat time.Time Role Role }
CoreClusterMember represents the global database entry for a dqlite cluster member.
func GetCoreClusterMember ¶
GetCoreClusterMember returns the core_cluster_member with the given key. generator: core_cluster_member GetOne
func GetCoreClusterMembers ¶
func GetCoreClusterMembers(ctx context.Context, tx *sql.Tx, filters ...CoreClusterMemberFilter) ([]CoreClusterMember, error)
GetCoreClusterMembers returns all available core_cluster_members. generator: core_cluster_member GetMany
func GetUpgradingClusterMembers ¶
func GetUpgradingClusterMembers(ctx context.Context, tx *sql.Tx, schemaInternal uint64, schemaExternal uint64, apiExtensions extensions.Extensions) (allMembers []CoreClusterMember, awaitingMembers map[string]bool, err error)
GetUpgradingClusterMembers returns the list of all cluster members during an upgrade, as well as a map of members who we consider to be in a waiting state. This function can be used immediately after dqlite is ready, before we have loaded any prepared statements. A cluster member will be in a waiting state if a different cluster member still exists with a smaller API extension count or schema version.
func (CoreClusterMember) ToAPI ¶
func (c CoreClusterMember) ToAPI() (*types.ClusterMember, error)
ToAPI returns the api struct for a ClusterMember database entity. The cluster member's status will be reported as unreachable by default.
type CoreClusterMemberFilter ¶
CoreClusterMemberFilter is used for filtering queries using generated methods.
type CoreTokenRecord ¶
type CoreTokenRecord struct { ID int Secret string `db:"primary=yes"` Name string ExpiryDate sql.NullTime }
CoreTokenRecord is the database representation of a join token record.
func GetCoreTokenRecord ¶
GetCoreTokenRecord returns the core_token_record with the given key. generator: core_token_record GetOne
func GetCoreTokenRecords ¶
func GetCoreTokenRecords(ctx context.Context, tx *sql.Tx, filters ...CoreTokenRecordFilter) ([]CoreTokenRecord, error)
GetCoreTokenRecords returns all available core_token_records. generator: core_token_record GetMany
func (*CoreTokenRecord) Expired ¶
func (t *CoreTokenRecord) Expired() bool
Expired compares the token's expiry date with the current time.
func (*CoreTokenRecord) ToAPI ¶
func (t *CoreTokenRecord) ToAPI(clusterCert *x509.Certificate, joinAddresses []types.AddrPort) (*internalTypes.TokenRecord, error)
ToAPI converts the CoreTokenRecord to a full token and returns an API compatible struct.
type CoreTokenRecordFilter ¶
CoreTokenRecordFilter is the filter struct for filtering results from generated methods.
type DqliteMember ¶
type DqliteMember struct { // dqlite.NodeInfo fields DqliteID uint64 `json:"id" yaml:"id"` Address string `json:"address" yaml:"address"` Role string `json:"role" yaml:"role"` Name string `json:"name" yaml:"name"` }
DqliteMember is the information that can be derived locally about a cluster member without access to the dqlite database.
func (DqliteMember) NodeInfo ¶
func (m DqliteMember) NodeInfo() (*dqlite.NodeInfo, error)
NodeInfo is used for interop with go-dqlite.