Documentation
¶
Overview ¶
Package database provides the database access functions and schema.
Index ¶
- Variables
- func AddSystemIDToNodes(_ context.Context, tx *sql.Tx) error
- func ConfigItemExists(ctx context.Context, tx *sql.Tx, key string) (bool, error)
- func ConfigSchemaUpdate(_ context.Context, tx *sql.Tx) error
- func CreateConfigItem(ctx context.Context, tx *sql.Tx, object ConfigItem) (int64, error)
- func CreateFeatureGate(ctx context.Context, tx *sql.Tx, object FeatureGate) (int64, error)
- func CreateJujuUser(ctx context.Context, tx *sql.Tx, object JujuUser) (int64, error)
- func CreateManifestItem(ctx context.Context, tx *sql.Tx, object ManifestItem) (int64, error)
- func CreateNode(ctx context.Context, tx *sql.Tx, object Node) (int64, error)
- func CreateStorageBackend(ctx context.Context, tx *sql.Tx, object StorageBackend) (int64, error)
- func DeleteConfigItem(_ context.Context, tx *sql.Tx, key string) error
- func DeleteFeatureGate(ctx context.Context, tx *sql.Tx, gateKey string) error
- func DeleteJujuUser(_ context.Context, tx *sql.Tx, username string) error
- func DeleteManifestItem(_ context.Context, tx *sql.Tx, manifestID string) error
- func DeleteNode(_ context.Context, tx *sql.Tx, name string) error
- func DeleteStorageBackend(_ context.Context, tx *sql.Tx, name string) error
- func FeatureGateExists(ctx context.Context, tx *sql.Tx, gateKey string) (bool, error)
- func FeatureGatesSchemaUpdate(_ context.Context, tx *sql.Tx) error
- func GetConfigItemID(ctx context.Context, tx *sql.Tx, key string) (int64, error)
- func GetConfigItemKeys(ctx context.Context, tx *sql.Tx, prefix *string) ([]string, error)
- func GetFeatureGateID(ctx context.Context, tx *sql.Tx, gateKey string) (int64, error)
- func GetJujuUserID(ctx context.Context, tx *sql.Tx, username string) (int64, error)
- func GetManifestItemID(ctx context.Context, tx *sql.Tx, manifestID string) (int64, error)
- func GetNodeID(ctx context.Context, tx *sql.Tx, name string) (int64, error)
- func GetStorageBackendID(ctx context.Context, tx *sql.Tx, name string) (int64, error)
- func JujuUserExists(ctx context.Context, tx *sql.Tx, username string) (bool, error)
- func JujuUserSchemaUpdate(_ context.Context, tx *sql.Tx) error
- func ManifestItemExists(ctx context.Context, tx *sql.Tx, manifestID string) (bool, error)
- func ManifestsSchemaUpdate(_ context.Context, tx *sql.Tx) error
- func NodeExists(ctx context.Context, tx *sql.Tx, name string) (bool, error)
- func NodesSchemaUpdate(_ context.Context, tx *sql.Tx) error
- func StorageBackendExists(ctx context.Context, tx *sql.Tx, name string) (bool, error)
- func StorageBackendSchemaUpdate(_ context.Context, tx *sql.Tx) error
- func UpdateConfigItem(ctx context.Context, tx *sql.Tx, key string, object ConfigItem) error
- func UpdateFeatureGate(ctx context.Context, tx *sql.Tx, gateKey string, object FeatureGate) error
- func UpdateJujuUser(ctx context.Context, tx *sql.Tx, username string, object JujuUser) error
- func UpdateNode(ctx context.Context, tx *sql.Tx, name string, object Node) error
- func UpdateStorageBackend(ctx context.Context, tx *sql.Tx, name string, object StorageBackend) error
- type ConfigItem
- type ConfigItemFilter
- type FeatureGate
- type FeatureGateFilter
- type JujuUser
- type JujuUserFilter
- type ManifestItem
- type ManifestItemFilter
- type Node
- type NodeFilter
- type StorageBackend
- type StorageBackendFilter
Constants ¶
This section is empty.
Variables ¶
var SchemaExtensions = []schema.Update{ NodesSchemaUpdate, ConfigSchemaUpdate, JujuUserSchemaUpdate, ManifestsSchemaUpdate, AddSystemIDToNodes, StorageBackendSchemaUpdate, FeatureGatesSchemaUpdate, }
SchemaExtensions is a list of schema extensions that can be passed to the MicroCluster daemon. Each entry will increase the database schema version by one, and will be applied after internal schema updates.
Functions ¶
func AddSystemIDToNodes ¶
AddSystemIDToNodes is schema update for table nodes
func ConfigItemExists ¶
ConfigItemExists checks if a ConfigItem with the given key exists. generator: ConfigItem Exists
func ConfigSchemaUpdate ¶
ConfigSchemaUpdate is schema for table config
func CreateConfigItem ¶
CreateConfigItem adds a new ConfigItem to the database. generator: ConfigItem Create
func CreateFeatureGate ¶
CreateFeatureGate creates a new FeatureGate.
func CreateJujuUser ¶
CreateJujuUser adds a new JujuUser to the database. generator: JujuUser Create
func CreateManifestItem ¶
CreateManifestItem adds a new ManifestItem to the database. generator: ManifestItem Create
func CreateNode ¶
CreateNode adds a new node to the database. generator: node Create
func CreateStorageBackend ¶
CreateStorageBackend adds a new StorageBackend to the database. generator: StorageBackend Create
func DeleteConfigItem ¶
DeleteConfigItem deletes the ConfigItem matching the given key parameters. generator: ConfigItem DeleteOne-by-Key
func DeleteFeatureGate ¶
DeleteFeatureGate deletes a FeatureGate by gate_key.
func DeleteJujuUser ¶
DeleteJujuUser deletes the JujuUser matching the given key parameters. generator: JujuUser DeleteOne-by-Username
func DeleteManifestItem ¶
DeleteManifestItem deletes the ManifestItem matching the given key parameters. generator: ManifestItem DeleteOne-by-ManifestID
func DeleteNode ¶
DeleteNode deletes the node matching the given key parameters. generator: node DeleteOne-by-Name
func DeleteStorageBackend ¶
DeleteStorageBackend deletes the StorageBackend matching the given key parameters. generator: StorageBackend DeleteOne-by-Name
func FeatureGateExists ¶
FeatureGateExists checks if a FeatureGate exists by gate_key.
func FeatureGatesSchemaUpdate ¶
FeatureGatesSchemaUpdate is schema for table feature_gates
func GetConfigItemID ¶
GetConfigItemID return the ID of the ConfigItem with the given key. generator: ConfigItem ID
func GetConfigItemKeys ¶
GetConfigItemKeys returns the list of ConfigItem keys from the database, filtered by prefix if provided.
func GetFeatureGateID ¶
GetFeatureGateID returns the ID of a FeatureGate by gate_key.
func GetJujuUserID ¶
GetJujuUserID return the ID of the JujuUser with the given key. generator: JujuUser ID
func GetManifestItemID ¶
GetManifestItemID return the ID of the ManifestItem with the given key. generator: ManifestItem ID
func GetStorageBackendID ¶
GetStorageBackendID return the ID of the StorageBackend with the given key. generator: StorageBackend ID
func JujuUserExists ¶
JujuUserExists checks if a JujuUser with the given key exists. generator: JujuUser Exists
func JujuUserSchemaUpdate ¶
JujuUserSchemaUpdate is schema for table jujuuser
func ManifestItemExists ¶
ManifestItemExists checks if a ManifestItem with the given key exists. generator: ManifestItem Exists
func ManifestsSchemaUpdate ¶
ManifestsSchemaUpdate is schema for table manifest TOCHK: TIMESTAMP(6) not storing nano seconds
func NodeExists ¶
NodeExists checks if a node with the given key exists. generator: node Exists
func NodesSchemaUpdate ¶
NodesSchemaUpdate is schema for table nodes
func StorageBackendExists ¶
StorageBackendExists checks if a StorageBackend with the given key exists. generator: StorageBackend Exists
func StorageBackendSchemaUpdate ¶
StorageBackendSchemaUpdate is schema for table storage_backends
func UpdateConfigItem ¶
UpdateConfigItem updates the ConfigItem matching the given key parameters. generator: ConfigItem Update
func UpdateFeatureGate ¶
UpdateFeatureGate updates a FeatureGate.
func UpdateJujuUser ¶
UpdateJujuUser updates the JujuUser matching the given key parameters. generator: JujuUser Update
func UpdateNode ¶
UpdateNode updates the node matching the given key parameters. generator: node Update
func UpdateStorageBackend ¶
func UpdateStorageBackend(ctx context.Context, tx *sql.Tx, name string, object StorageBackend) error
UpdateStorageBackend updates the StorageBackend matching the given key parameters. generator: StorageBackend Update
Types ¶
type ConfigItem ¶
ConfigItem is used to track the Ceph configuration.
func GetConfigItem ¶
GetConfigItem returns the ConfigItem with the given key. generator: ConfigItem GetOne
func GetConfigItems ¶
func GetConfigItems(ctx context.Context, tx *sql.Tx, filters ...ConfigItemFilter) ([]ConfigItem, error)
GetConfigItems returns all available ConfigItems. generator: ConfigItem GetMany
type ConfigItemFilter ¶
type ConfigItemFilter struct {
Key *string
}
ConfigItemFilter is a required struct for use with lxd-generate. It is used for filtering fields on database fetches.
type FeatureGate ¶
FeatureGate is used to track feature gate configuration.
func GetFeatureGate ¶
GetFeatureGate returns a single FeatureGate by gate_key.
func GetFeatureGates ¶
GetFeatureGates returns all available FeatureGates.
type FeatureGateFilter ¶
type FeatureGateFilter struct {
GateKey *string
}
FeatureGateFilter is a required struct for use with lxd-generate. It is used for filtering fields on database fetches.
type JujuUser ¶
JujuUser is used to track User and registration token information.
func GetJujuUser ¶
GetJujuUser returns the JujuUser with the given key. generator: JujuUser GetOne
func GetJujuUsers ¶
GetJujuUsers returns all available JujuUsers. generator: JujuUser GetMany
type JujuUserFilter ¶
type JujuUserFilter struct {
Username *string
}
JujuUserFilter is a required struct for use with lxd-generate. It is used for filtering fields on database fetches.
type ManifestItem ¶
type ManifestItem struct {
ID int
ManifestID string `db:"primary=yes"`
AppliedDate string
Data string
}
ManifestItem is used to save the Sunbeam manifests provided by user. AppliedDate is saved as Timestamp in database but retreived as string Probable Bug: https://github.com/mattn/go-sqlite3/issues/951
func GetLatestManifestItem ¶
GetLatestManifestItem returns the latest inserted record in manifest table.
func GetManifestItem ¶
GetManifestItem returns the ManifestItem with the given key. generator: ManifestItem GetOne
func GetManifestItems ¶
func GetManifestItems(ctx context.Context, tx *sql.Tx, filters ...ManifestItemFilter) ([]ManifestItem, error)
GetManifestItems returns all available ManifestItems. generator: ManifestItem GetMany
type ManifestItemFilter ¶
type ManifestItemFilter struct {
ManifestID *string
}
ManifestItemFilter is a required struct for use with lxd-generate. It is used for filtering fields on database fetches.
type Node ¶
type Node struct {
ID int
Member string `db:"join=core_cluster_members.name&joinon=nodes.member_id"`
Name string `db:"primary=yes"`
Role string
MachineID int
SystemID string
}
Node is used to track Node information.
type NodeFilter ¶
NodeFilter is a required struct for use with lxd-generate. It is used for filtering fields on database fetches.
type StorageBackend ¶
type StorageBackend struct {
ID int
Name string `db:"primary=yes"`
Type string
Config string
Principal string
ModelUUID string
}
StorageBackend is used to track StorageBackend information.
func GetStorageBackend ¶
GetStorageBackend returns the StorageBackend with the given key. generator: StorageBackend GetOne
func GetStorageBackends ¶
func GetStorageBackends(ctx context.Context, tx *sql.Tx, filters ...StorageBackendFilter) ([]StorageBackend, error)
GetStorageBackends returns all available StorageBackends. generator: StorageBackend GetMany