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 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 DeleteConfigItem(_ context.Context, tx *sql.Tx, key 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 GetConfigItemID(ctx context.Context, tx *sql.Tx, key string) (int64, error)
- func GetConfigItemKeys(ctx context.Context, tx *sql.Tx, prefix *string) ([]string, 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 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 UpdateConfigItem(ctx context.Context, tx *sql.Tx, key string, object ConfigItem) 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
- type ConfigItem
- type ConfigItemFilter
- type JujuUser
- type JujuUserFilter
- type ManifestItem
- type ManifestItemFilter
- type Node
- type NodeFilter
Constants ¶
This section is empty.
Variables ¶
var SchemaExtensions = []schema.Update{ NodesSchemaUpdate, ConfigSchemaUpdate, JujuUserSchemaUpdate, ManifestsSchemaUpdate, AddSystemIDToNodes, }
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 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 DeleteConfigItem ¶
DeleteConfigItem deletes the ConfigItem matching the given key parameters. generator: ConfigItem DeleteOne-by-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 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 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 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 UpdateConfigItem ¶
UpdateConfigItem updates the ConfigItem matching the given key parameters. generator: ConfigItem Update
func UpdateJujuUser ¶
UpdateJujuUser updates the JujuUser matching the given key parameters. generator: JujuUser 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 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.