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 GetCoreClusterMemberID(ctx context.Context, tx *sql.Tx, name string) (int64, error)
- func GetCoreTokenRecordID(ctx context.Context, tx *sql.Tx, secret string) (int64, 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 Role
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.
func CoreTokenRecordExists ¶
CoreTokenRecordExists checks if a core_token_record with the given key 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.
func CreateCoreTokenRecord ¶
CreateCoreTokenRecord adds a new core_token_record to the database.
func DeleteCoreClusterMember ¶
DeleteCoreClusterMember deletes the core_cluster_member matching the given key parameters.
func DeleteCoreTokenRecord ¶
DeleteCoreTokenRecord deletes the core_token_record matching the given key parameters.
func DeleteExpiredCoreTokenRecords ¶
DeleteExpiredCoreTokenRecords cleans up expired tokens.
func GetCoreClusterMemberID ¶
GetCoreClusterMemberID return the ID of the core_cluster_member with the given key.
func GetCoreTokenRecordID ¶
GetCoreTokenRecordID return the ID of the core_token_record with the given key.
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.
Types ¶
type CoreClusterMember ¶
type CoreClusterMember struct {
ID int
Name string `db:"primary=yes"`
Address string
Certificate string
SchemaInternal uint64
SchemaExternal uint64
APIExtensions types.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.
func GetCoreClusterMembers ¶
func GetCoreClusterMembers(ctx context.Context, tx *sql.Tx, filters ...CoreClusterMemberFilter) ([]CoreClusterMember, error)
GetCoreClusterMembers returns all available core_cluster_members.
func GetUpgradingClusterMembers ¶
func GetUpgradingClusterMembers(ctx context.Context, tx *sql.Tx, schemaInternal uint64, schemaExternal uint64, apiExtensions types.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.
func GetCoreTokenRecords ¶
func GetCoreTokenRecords(ctx context.Context, tx *sql.Tx, filters ...CoreTokenRecordFilter) ([]CoreTokenRecord, error)
GetCoreTokenRecords returns all available core_token_records.
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) (*types.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.