Documentation ¶
Index ¶
- Constants
- Variables
- func ClusterGroupToAPI(clusterGroup *cluster.ClusterGroup, nodes []string) *api.ClusterGroup
- func CreateInstanceConfig(tx *sql.Tx, id int, config map[string]string) error
- func DqliteLatestSegment() (string, error)
- func ExpandInstanceConfig(config map[string]string, profiles []api.Profile) map[string]string
- func ExpandInstanceDevices(devices deviceConfig.Devices, profiles []api.Profile) deviceConfig.Devices
- func NetworkStateToAPIStatus(state NetworkState) string
- func NewTestDqliteServer(t *testing.T) (string, driver.NodeStore, func())
- func StoragePoolStateToAPIStatus(state StoragePoolState) string
- func TxCommit(tx *sql.Tx) error
- func UpdateInstance(tx *sql.Tx, id int, description string, architecture int, ephemeral bool, ...) error
- type Cluster
- func (c *Cluster) AddImageToLocalNode(project, fingerprint string) error
- func (c *Cluster) Begin() (*sql.Tx, error)
- func (c *Cluster) Close() error
- func (c *Cluster) CopyDefaultImageProfiles(id int, newID int) error
- func (c *Cluster) CreateImage(project string, fp string, fname string, sz int64, public bool, ...) error
- func (c *Cluster) CreateImageSource(id int, server string, protocol string, certificate string, alias string) error
- func (c *Cluster) CreateInstanceBackup(args InstanceBackup) error
- func (c *Cluster) CreateNetwork(projectName string, name string, description string, netType NetworkType, ...) (int64, error)
- func (c *Cluster) CreateNetworkACL(projectName string, info *api.NetworkACLsPost) (int64, error)
- func (c *Cluster) CreateNetworkForward(networkID int64, memberSpecific bool, info *api.NetworkForwardsPost) (int64, error)
- func (c *Cluster) CreateNetworkLoadBalancer(networkID int64, memberSpecific bool, info *api.NetworkLoadBalancersPost) (int64, error)
- func (c *Cluster) CreateNetworkPeer(networkID int64, info *api.NetworkPeersPost) (int64, bool, error)
- func (c *Cluster) CreateNetworkZone(projectName string, info *api.NetworkZonesPost) (int64, error)
- func (c *Cluster) CreateNetworkZoneRecord(zone int64, info api.NetworkZoneRecordsPost) (int64, error)
- func (c *Cluster) CreateStoragePool(poolName string, poolDescription string, poolDriver string, ...) (int64, error)
- func (c *Cluster) CreateStoragePoolBucket(ctx context.Context, poolID int64, projectName string, memberSpecific bool, ...) (int64, error)
- func (c *Cluster) CreateStoragePoolBucketKey(ctx context.Context, bucketID int64, info api.StorageBucketKeysPost) (int64, error)
- func (c *Cluster) CreateStoragePoolVolume(projectName string, volumeName string, volumeDescription string, ...) (int64, error)
- func (c *Cluster) CreateStoragePoolVolumeBackup(args StoragePoolVolumeBackup) error
- func (c *Cluster) CreateStorageVolumeSnapshot(projectName string, volumeName string, volumeDescription string, ...) (int64, error)
- func (c *Cluster) DB() *sql.DB
- func (c *Cluster) DeleteImage(id int) error
- func (c *Cluster) DeleteInstance(project, name string) error
- func (c *Cluster) DeleteInstanceBackup(name string) error
- func (c *Cluster) DeleteInstanceConfigKey(id int, key string) error
- func (c *Cluster) DeleteNetwork(project string, name string) error
- func (c *Cluster) DeleteNetworkACL(id int64) error
- func (c *Cluster) DeleteNetworkForward(networkID int64, forwardID int64) error
- func (c *Cluster) DeleteNetworkLoadBalancer(networkID int64, loadBalancerID int64) error
- func (c *Cluster) DeleteNetworkPeer(networkID int64, peerID int64) error
- func (c *Cluster) DeleteNetworkZone(id int64) error
- func (c *Cluster) DeleteNetworkZoneRecord(id int64) error
- func (c *Cluster) DeleteReadyStateFromLocalInstances() error
- func (c *Cluster) DeleteStoragePoolBucket(ctx context.Context, poolID int64, bucketID int64) error
- func (c *Cluster) DeleteStoragePoolBucketKey(ctx context.Context, bucketID int64, keyID int64) error
- func (c *Cluster) DeleteStoragePoolVolumeBackup(name string) error
- func (c *Cluster) EnterExclusive() error
- func (c *Cluster) ExitExclusive(ctx context.Context, f func(context.Context, *ClusterTx) error) error
- func (c *Cluster) GetCreatedNetworks(project string) ([]string, error)
- func (c *Cluster) GetCreatedStoragePoolNames() ([]string, error)
- func (c *Cluster) GetExpiredInstanceBackups() ([]InstanceBackup, error)
- func (c *Cluster) GetImage(fingerprintPrefix string, filter cluster.ImageFilter) (int, *api.Image, error)
- func (c *Cluster) GetImageFromAnyProject(fingerprint string) (int, *api.Image, error)
- func (c *Cluster) GetImages() (map[string][]string, error)
- func (c *Cluster) GetImagesOnLocalNode() (map[string][]string, error)
- func (c *Cluster) GetImagesOnNode(id int64) (map[string][]string, error)
- func (c *Cluster) GetInstanceBackup(projectName string, name string) (InstanceBackup, error)
- func (c *Cluster) GetInstanceBackupWithID(backupID int) (InstanceBackup, error)
- func (c *Cluster) GetInstanceBackups(projectName string, name string) ([]string, error)
- func (c *Cluster) GetInstanceConfig(id int, key string) (string, error)
- func (c *Cluster) GetInstanceID(project, name string) (int, error)
- func (c *Cluster) GetInstancePool(project, instanceName string) (string, error)
- func (c *Cluster) GetInstanceProjectAndName(id int) (string, string, error)
- func (c *Cluster) GetInstanceSnapshotID(project, instance, name string) (int, error)
- func (c *Cluster) GetInstanceSnapshotsNames(project, name string) ([]string, error)
- func (c *Cluster) GetInstancesWithProfile(project, profile string) (map[string][]string, error)
- func (c *Cluster) GetLocalStoragePoolVolumeSnapshotsWithType(projectName string, volumeName string, volumeType int, poolID int64) ([]StorageVolumeArgs, error)
- func (c *Cluster) GetNetworkACL(projectName string, name string) (int64, *api.NetworkACL, error)
- func (c *Cluster) GetNetworkACLIDsByNames(project string) (map[string]int64, error)
- func (c *Cluster) GetNetworkACLNameAndProjectWithID(networkACLID int) (string, string, error)
- func (c *Cluster) GetNetworkACLs(project string) ([]string, error)
- func (c *Cluster) GetNetworkForward(ctx context.Context, networkID int64, memberSpecific bool, ...) (int64, *api.NetworkForward, error)
- func (c *Cluster) GetNetworkForwardListenAddresses(networkID int64, memberSpecific bool) (map[int64]string, error)
- func (c *Cluster) GetNetworkForwards(ctx context.Context, networkID int64, memberSpecific bool, ...) (map[int64]*api.NetworkForward, error)
- func (c *Cluster) GetNetworkInAnyState(projectName string, networkName string) (int64, *api.Network, map[int64]NetworkNode, error)
- func (c *Cluster) GetNetworkLoadBalancer(ctx context.Context, networkID int64, memberSpecific bool, ...) (int64, *api.NetworkLoadBalancer, error)
- func (c *Cluster) GetNetworkLoadBalancerListenAddresses(networkID int64, memberSpecific bool) (map[int64]string, error)
- func (c *Cluster) GetNetworkLoadBalancers(ctx context.Context, networkID int64, memberSpecific bool, ...) (map[int64]*api.NetworkLoadBalancer, error)
- func (c *Cluster) GetNetworkNameAndProjectWithID(networkID int) (string, string, error)
- func (c *Cluster) GetNetworkPeer(networkID int64, peerName string) (int64, *api.NetworkPeer, error)
- func (c *Cluster) GetNetworkPeerNames(networkID int64) (map[int64]string, error)
- func (c *Cluster) GetNetworkPeers(networkID int64) (map[int64]*api.NetworkPeer, error)
- func (c *Cluster) GetNetworkPeersTargetNetworkIDs(projectName string, networkType NetworkType) (map[NetworkPeer]int64, error)
- func (c *Cluster) GetNetworkWithInterface(devName string) (int64, *api.Network, error)
- func (c *Cluster) GetNetworkZone(name string) (int64, string, *api.NetworkZone, error)
- func (c *Cluster) GetNetworkZoneByProject(projectName string, name string) (int64, *api.NetworkZone, error)
- func (c *Cluster) GetNetworkZoneKeys() (map[string]string, error)
- func (c *Cluster) GetNetworkZoneRecord(zone int64, name string) (int64, *api.NetworkZoneRecord, error)
- func (c *Cluster) GetNetworkZoneRecordNames(zone int64) ([]string, error)
- func (c *Cluster) GetNetworkZonesByProject(project string) ([]string, error)
- func (c *Cluster) GetNetworks(project string) ([]string, error)
- func (c *Cluster) GetNextInstanceSnapshotIndex(project string, name string, pattern string) int
- func (c *Cluster) GetNextStorageVolumeSnapshotIndex(pool, name string, typ int, pattern string) int
- func (c *Cluster) GetNodeID() int64
- func (c *Cluster) GetNodesWithImage(fingerprint string) ([]string, error)
- func (c *Cluster) GetNodesWithImageAndAutoUpdate(fingerprint string, autoUpdate bool) ([]string, error)
- func (c *Cluster) GetNodesWithoutImage(fingerprint string) ([]string, error)
- func (c *Cluster) GetPoolNamesFromIDs(poolIDs []int64) ([]string, error)
- func (c *Cluster) GetPoolsWithImage(imageFingerprint string) ([]int64, error)
- func (c *Cluster) GetProfile(project, name string) (int64, *api.Profile, error)
- func (c *Cluster) GetProfileNames(project string) ([]string, error)
- func (c *Cluster) GetProfiles(projectName string, profileNames []string) ([]api.Profile, error)
- func (c *Cluster) GetStoragePool(poolName string) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
- func (c *Cluster) GetStoragePoolDrivers() ([]string, error)
- func (c *Cluster) GetStoragePoolID(poolName string) (int64, error)
- func (c *Cluster) GetStoragePoolInAnyState(poolName string) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
- func (c *Cluster) GetStoragePoolNames() ([]string, error)
- func (c *Cluster) GetStoragePoolNodeVolumeID(projectName string, volumeName string, volumeType int, poolID int64) (int64, error)
- func (c *Cluster) GetStoragePoolVolumeBackup(projectName string, poolName string, backupName string) (StoragePoolVolumeBackup, error)
- func (c *Cluster) GetStoragePoolVolumeBackupWithID(backupID int) (StoragePoolVolumeBackup, error)
- func (c *Cluster) GetStoragePoolVolumeBackups(projectName string, volumeName string, poolID int64) ([]StoragePoolVolumeBackup, error)
- func (c *Cluster) GetStoragePoolVolumeBackupsNames(projectName string, volumeName string, poolID int64) ([]string, error)
- func (c *Cluster) GetStoragePoolWithID(poolID int) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
- func (c *Cluster) GetStoragePools(ctx context.Context, state *StoragePoolState, poolNames ...string) (map[int64]api.StoragePool, map[int64]map[int64]StoragePoolNode, error)
- func (c *Cluster) GetStorageVolumeSnapshotExpiry(volumeID int64) (time.Time, error)
- func (c *Cluster) GetStorageVolumeSnapshotWithID(snapshotID int) (StorageVolumeArgs, error)
- func (c *Cluster) GetURIFromEntity(entityType int, entityID int) (string, error)
- func (c *Cluster) ImageExists(project string, fingerprint string) (bool, error)
- func (c *Cluster) ImageIsReferencedByOtherProjects(project string, fingerprint string) (bool, error)
- func (c *Cluster) InstanceList(ctx context.Context, ...) error
- func (c *Cluster) IsRemoteStorage(poolID int64) (bool, error)
- func (c *Cluster) LocalNodeIsEvacuated() bool
- func (c *Cluster) LocateImage(fingerprint string) (string, error)
- func (c *Cluster) MoveImageAlias(source int, destination int) error
- func (c *Cluster) NodeID(id int64)
- func (c *Cluster) RemoveStoragePool(poolName string) (*api.StoragePool, error)
- func (c *Cluster) RemoveStoragePoolVolume(projectName string, volumeName string, volumeType int, poolID int64) error
- func (c *Cluster) RemoveUnreferencedProfiles() error
- func (c *Cluster) RenameImageAlias(id int, name string) error
- func (c *Cluster) RenameInstanceBackup(oldName, newName string) error
- func (c *Cluster) RenameNetwork(project string, oldName string, newName string) error
- func (c *Cluster) RenameNetworkACL(id int64, newName string) error
- func (c *Cluster) RenameStoragePoolVolume(projectName string, oldVolumeName string, newVolumeName string, volumeType int, ...) error
- func (c *Cluster) RenameVolumeBackup(oldName, newName string) error
- func (c *Cluster) SetImageCachedAndLastUseDate(projectName string, fingerprint string, lastUsed time.Time) error
- func (c *Cluster) Transaction(ctx context.Context, f func(context.Context, *ClusterTx) error) error
- func (c *Cluster) UpdateImage(id int, fname string, sz int64, public bool, autoUpdate bool, ...) error
- func (c *Cluster) UpdateInstanceSnapshotCreationDate(instanceID int, date time.Time) error
- func (c *Cluster) UpdateInstanceStatefulFlag(id int, stateful bool) error
- func (c *Cluster) UpdateNetwork(project string, name, description string, config map[string]string) error
- func (c *Cluster) UpdateNetworkACL(id int64, config *api.NetworkACLPut) error
- func (c *Cluster) UpdateNetworkForward(networkID int64, forwardID int64, info *api.NetworkForwardPut) error
- func (c *Cluster) UpdateNetworkLoadBalancer(networkID int64, loadBalancerID int64, info *api.NetworkLoadBalancerPut) error
- func (c *Cluster) UpdateNetworkPeer(networkID int64, peerID int64, info *api.NetworkPeerPut) error
- func (c *Cluster) UpdateNetworkZone(id int64, config *api.NetworkZonePut) error
- func (c *Cluster) UpdateNetworkZoneRecord(id int64, config api.NetworkZoneRecordPut) error
- func (c *Cluster) UpdateStoragePool(poolName, description string, poolConfig map[string]string) error
- func (c *Cluster) UpdateStoragePoolBucket(ctx context.Context, poolID int64, bucketID int64, info *api.StorageBucketPut) error
- func (c *Cluster) UpdateStoragePoolBucketKey(ctx context.Context, bucketID int64, bucketKeyID int64, ...) error
- func (c *Cluster) UpdateStoragePoolVolume(projectName string, volumeName string, volumeType int, poolID int64, ...) error
- func (c *Cluster) UpdateStorageVolumeSnapshot(projectName string, volumeName string, volumeType int, poolID int64, ...) error
- func (c *Cluster) UpsertWarning(nodeName string, projectName string, entityTypeCode int, entityID int, ...) error
- func (c *Cluster) UpsertWarningLocalNode(projectName string, entityTypeCode int, entityID int, ...) error
- type ClusterRole
- type ClusterTx
- func (c *ClusterTx) AddNodeToClusterGroup(ctx context.Context, groupName string, nodeName string) error
- func (c *ClusterTx) BootstrapNode(name string, address string) error
- func (c *ClusterTx) ClearNode(ctx context.Context, id int64) error
- func (c *ClusterTx) Config(ctx context.Context) (map[string]string, error)
- func (c *ClusterTx) CreateImageAlias(ctx context.Context, projectName, aliasName string, imageID int, desc string) error
- func (c *ClusterTx) CreateInstanceConfig(id int, config map[string]string) error
- func (c *ClusterTx) CreateNetworkConfig(networkID, nodeID int64, config map[string]string) error
- func (c *ClusterTx) CreateNode(name string, address string) (int64, error)
- func (c *ClusterTx) CreateNodeWithArch(name string, address string, arch int) (int64, error)
- func (c *ClusterTx) CreatePendingNetwork(ctx context.Context, node string, projectName string, name string, ...) error
- func (c *ClusterTx) CreatePendingStoragePool(ctx context.Context, node string, name string, driver string, ...) error
- func (c *ClusterTx) CreateStoragePoolConfig(poolID, nodeID int64, config map[string]string) error
- func (c *ClusterTx) DeleteImageAlias(ctx context.Context, projectName string, name string) error
- func (c *ClusterTx) DeleteInstanceConfigKey(id int64, key string) error
- func (c *ClusterTx) GetAllNodesWithOperations(ctx context.Context) ([]string, error)
- func (c *ClusterTx) GetCachedImageSourceFingerprint(ctx context.Context, server string, protocol string, alias string, ...) (string, error)
- func (c *ClusterTx) GetCandidateMembers(ctx context.Context, allMembers []NodeInfo, targetArchitectures []int, ...) ([]NodeInfo, error)
- func (c *ClusterTx) GetClusterGroupNodes(ctx context.Context, groupName string) ([]string, error)
- func (c *ClusterTx) GetClusterGroupURIs(ctx context.Context, filter cluster.ClusterGroupFilter) ([]string, error)
- func (c *ClusterTx) GetClusterGroupsWithNode(ctx context.Context, nodeName string) ([]string, error)
- func (c *ClusterTx) GetCreatedNetworks(ctx context.Context) (map[string]map[int64]api.Network, error)
- func (c *ClusterTx) GetCreatedNetworksByProject(ctx context.Context, projectName string) (map[int64]api.Network, error)
- func (c *ClusterTx) GetCustomVolumesInProject(ctx context.Context, project string) ([]StorageVolumeArgs, error)
- func (c *ClusterTx) GetExpiredStorageVolumeBackups(ctx context.Context) ([]StoragePoolVolumeBackup, error)
- func (c *ClusterTx) GetExpiredStorageVolumeSnapshots(ctx context.Context, memberSpecific bool) ([]StorageVolumeArgs, error)
- func (c *ClusterTx) GetFailureDomainsNames(ctx context.Context) (map[uint64]string, error)
- func (c *ClusterTx) GetImageAlias(ctx context.Context, projectName string, imageName string, ...) (int, api.ImageAliasesEntry, error)
- func (c *ClusterTx) GetImageAliases(ctx context.Context, projectName string) ([]string, error)
- func (c *ClusterTx) GetImageByFingerprintPrefix(ctx context.Context, fingerprintPrefix string, filter cluster.ImageFilter) (int, *api.Image, error)
- func (c *ClusterTx) GetImageSource(ctx context.Context, imageID int) (int, api.ImageSource, error)
- func (c *ClusterTx) GetImagesFingerprints(ctx context.Context, projectName string, publicOnly bool) ([]string, error)
- func (c *ClusterTx) GetInstanceNames(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) GetInstancePool(ctx context.Context, projectName string, instanceName string) (string, error)
- func (c *ClusterTx) GetInstanceSnapshotsWithName(ctx context.Context, project string, name string) ([]cluster.Instance, error)
- func (c *ClusterTx) GetInstancesByMemberAddress(ctx context.Context, offlineThreshold time.Duration, projects []string, ...) (map[string][]Instance, error)
- func (c *ClusterTx) GetLocalExpiredInstanceSnapshots(ctx context.Context) ([]cluster.InstanceSnapshot, error)
- func (c *ClusterTx) GetLocalImagesFingerprints(ctx context.Context) ([]string, error)
- func (c *ClusterTx) GetLocalInstanceWithVsockID(ctx context.Context, vsockID int) (*cluster.Instance, error)
- func (c *ClusterTx) GetLocalInstancesInProject(ctx context.Context, filter cluster.InstanceFilter) ([]cluster.Instance, error)
- func (c *ClusterTx) GetLocalNodeAddress(ctx context.Context) (string, error)
- func (c *ClusterTx) GetLocalNodeName(ctx context.Context) (string, error)
- func (c *ClusterTx) GetNetworkACLURIs(ctx context.Context, projectID int, project string) ([]string, error)
- func (c *ClusterTx) GetNetworkID(ctx context.Context, projectName string, name string) (int64, error)
- func (c *ClusterTx) GetNetworkURIs(ctx context.Context, projectID int, project string) ([]string, error)
- func (c *ClusterTx) GetNetworkZones(ctx context.Context) (map[string]string, error)
- func (c *ClusterTx) GetNetworksLocalConfig(ctx context.Context) (map[string]map[string]string, error)
- func (c *ClusterTx) GetNodeAddressOfInstance(ctx context.Context, project string, name string, instType instancetype.Type) (string, error)
- func (c *ClusterTx) GetNodeByAddress(ctx context.Context, address string) (NodeInfo, error)
- func (c *ClusterTx) GetNodeByName(ctx context.Context, name string) (NodeInfo, error)
- func (c *ClusterTx) GetNodeFailureDomain(ctx context.Context, id int64) (string, error)
- func (c *ClusterTx) GetNodeID() int64
- func (c *ClusterTx) GetNodeMaxVersion(ctx context.Context) ([2]int, error)
- func (c *ClusterTx) GetNodeOfflineThreshold(ctx context.Context) (time.Duration, error)
- func (c *ClusterTx) GetNodeWithID(ctx context.Context, nodeID int) (NodeInfo, error)
- func (c *ClusterTx) GetNodeWithLeastInstances(ctx context.Context, members []NodeInfo) (*NodeInfo, error)
- func (c *ClusterTx) GetNodes(ctx context.Context) ([]NodeInfo, error)
- func (c *ClusterTx) GetNodesCount(ctx context.Context) (int, error)
- func (c *ClusterTx) GetNodesFailureDomains(ctx context.Context) (map[string]uint64, error)
- func (c *ClusterTx) GetNodesWithOperations(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) GetNonPendingNetworkIDs(ctx context.Context) (map[string]map[string]int64, error)
- func (c *ClusterTx) GetNonPendingStoragePoolsNamesToIDs(ctx context.Context) (map[string]int64, error)
- func (c *ClusterTx) GetOperationsOfType(ctx context.Context, projectName string, opType operationtype.Type) ([]cluster.Operation, error)
- func (c *ClusterTx) GetPendingNodeByAddress(ctx context.Context, address string) (NodeInfo, error)
- func (c *ClusterTx) GetProjectNetworkForwardListenAddressesByUplink(ctx context.Context, uplinkNetworkName string, memberSpecific bool) (map[string]map[string][]string, error)
- func (c *ClusterTx) GetProjectNetworkForwardListenAddressesOnMember(ctx context.Context) (map[string]map[int64][]string, error)
- func (c *ClusterTx) GetProjectNetworkLoadBalancerListenAddressesByUplink(ctx context.Context, uplinkNetworkName string, memberSpecific bool) (map[string]map[string][]string, error)
- func (c *ClusterTx) GetProjectNetworkLoadBalancerListenAddressesOnMember(ctx context.Context) (map[string]map[int64][]string, error)
- func (c *ClusterTx) GetProjectsUsingImage(ctx context.Context, fingerprint string) ([]string, error)
- func (c *ClusterTx) GetStoragePoolBucket(ctx context.Context, poolID int64, projectName string, memberSpecific bool, ...) (*StorageBucket, error)
- func (c *ClusterTx) GetStoragePoolBucketKey(ctx context.Context, bucketID int64, keyName string) (*StorageBucketKey, error)
- func (c *ClusterTx) GetStoragePoolBucketKeys(ctx context.Context, bucketID int64, filters ...StorageBucketKeyFilter) ([]*StorageBucketKey, error)
- func (c *ClusterTx) GetStoragePoolBuckets(ctx context.Context, memberSpecific bool, filters ...StorageBucketFilter) ([]*StorageBucket, error)
- func (c *ClusterTx) GetStoragePoolDriver(ctx context.Context, id int64) (string, error)
- func (c *ClusterTx) GetStoragePoolID(ctx context.Context, name string) (int64, error)
- func (c *ClusterTx) GetStoragePoolLocalBucket(ctx context.Context, bucketName string) (*StorageBucket, error)
- func (c *ClusterTx) GetStoragePoolLocalBucketByAccessKey(ctx context.Context, accessKey string) (*StorageBucket, error)
- func (c *ClusterTx) GetStoragePoolNodeConfigs(ctx context.Context, poolID int64) (map[string]map[string]string, error)
- func (c *ClusterTx) GetStoragePoolVolume(ctx context.Context, poolID int64, projectName string, volumeType int, ...) (*StorageVolume, error)
- func (c *ClusterTx) GetStoragePoolVolumeWithID(ctx context.Context, volumeID int) (StorageVolumeArgs, error)
- func (c *ClusterTx) GetStoragePoolVolumes(ctx context.Context, poolID int64, memberSpecific bool, ...) ([]*StorageVolume, error)
- func (c *ClusterTx) GetStoragePoolVolumesWithType(ctx context.Context, volumeType int, memberSpecific bool) ([]StorageVolumeArgs, error)
- func (c *ClusterTx) GetStoragePoolsLocalConfig(ctx context.Context) (map[string]map[string]string, error)
- func (c *ClusterTx) GetStorageVolumeNodes(ctx context.Context, poolID int64, projectName string, volumeName string, ...) ([]NodeInfo, error)
- func (c *ClusterTx) GetStorageVolumeURIs(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) InstancesToInstanceArgs(ctx context.Context, fillProfiles bool, instances ...cluster.Instance) (map[int]InstanceArgs, error)
- func (c *ClusterTx) NetworkCreated(project string, name string) error
- func (c *ClusterTx) NetworkErrored(project string, name string) error
- func (c *ClusterTx) NetworkNodeConfigs(ctx context.Context, networkID int64) (map[string]map[string]string, error)
- func (c *ClusterTx) NetworkNodeCreated(networkID int64) error
- func (c *ClusterTx) NetworkNodeJoin(networkID, nodeID int64) error
- func (c *ClusterTx) NetworkNodes(ctx context.Context, networkID int64) (map[int64]NetworkNode, error)
- func (c *ClusterTx) NodeID(id int64)
- func (c *ClusterTx) NodeIsEmpty(ctx context.Context, id int64) (string, error)
- func (c *ClusterTx) NodeIsOutdated(ctx context.Context) (bool, error)
- func (c *ClusterTx) RemoveNode(id int64) error
- func (c *ClusterTx) RemoveNodeFromClusterGroup(ctx context.Context, groupName string, nodeName string) error
- func (c *ClusterTx) RenameNode(ctx context.Context, old string, new string) error
- func (c *ClusterTx) SetDescription(id int64, description string) error
- func (c *ClusterTx) SetNodeHeartbeat(address string, heartbeat time.Time) error
- func (c *ClusterTx) SetNodePendingFlag(id int64, pending bool) error
- func (c *ClusterTx) SetNodeVersion(id int64, version [2]int) error
- func (c *ClusterTx) StoragePoolCreated(name string) error
- func (c *ClusterTx) StoragePoolErrored(name string) error
- func (c *ClusterTx) StoragePoolNodeCreated(poolID int64) error
- func (c *ClusterTx) Tx() *sql.Tx
- func (c *ClusterTx) UpdateCephStoragePoolAfterNodeJoin(ctx context.Context, poolID int64, nodeID int64) error
- func (c *ClusterTx) UpdateClusterConfig(values map[string]string) error
- func (c *ClusterTx) UpdateImageAlias(ctx context.Context, aliasID int, imageID int, desc string) error
- func (c *ClusterTx) UpdateImageLastUseDate(ctx context.Context, projectName string, fingerprint string, ...) error
- func (c *ClusterTx) UpdateInstanceConfig(id int, values map[string]string) error
- func (c *ClusterTx) UpdateInstanceLastUsedDate(id int, date time.Time) error
- func (c *ClusterTx) UpdateInstanceNode(ctx context.Context, project string, oldName string, newName string, ...) error
- func (c *ClusterTx) UpdateInstancePowerState(id int, state string) error
- func (c *ClusterTx) UpdateInstanceSnapshot(id int, description string, expiryDate time.Time) error
- func (c *ClusterTx) UpdateInstanceSnapshotConfig(id int, values map[string]string) error
- func (c *ClusterTx) UpdateNetwork(id int64, description string, config map[string]string) error
- func (c *ClusterTx) UpdateNodeClusterGroups(ctx context.Context, id int64, groups []string) error
- func (c *ClusterTx) UpdateNodeConfig(ctx context.Context, id int64, config map[string]string) error
- func (c *ClusterTx) UpdateNodeFailureDomain(ctx context.Context, id int64, domain string) error
- func (c *ClusterTx) UpdateNodeRoles(id int64, roles []ClusterRole) error
- func (c *ClusterTx) UpdateNodeStatus(id int64, state int) error
- func (c *ClusterTx) UpdateStoragePoolAfterNodeJoin(poolID, nodeID int64) error
- func (c *ClusterTx) UpdateStorageVolumeNode(ctx context.Context, projectName string, oldName string, newName string, ...) error
- func (c *ClusterTx) UpdateWarningState(UUID string, message string, status warningtype.Status) error
- func (c *ClusterTx) UpdateWarningStatus(UUID string, status warningtype.Status) error
- type DB
- type Instance
- type InstanceArgs
- type InstanceBackup
- type NetworkNode
- type NetworkPeer
- type NetworkState
- type NetworkType
- type Node
- type NodeInfo
- type NodeInfoArgs
- type NodeTx
- func (n *NodeTx) Config(ctx context.Context) (map[string]string, error)
- func (n *NodeTx) CreateFirstRaftNode(address string, name string) error
- func (n *NodeTx) CreateRaftNode(address string, name string) (int64, error)
- func (n *NodeTx) GetCertificates(ctx context.Context) ([]cluster.Certificate, error)
- func (n *NodeTx) GetRaftNodeAddress(ctx context.Context, id int64) (string, error)
- func (n *NodeTx) GetRaftNodeAddresses(ctx context.Context) ([]string, error)
- func (n *NodeTx) GetRaftNodes(ctx context.Context) ([]RaftNode, error)
- func (n *NodeTx) RemoveRaftNode(id int64) error
- func (n *NodeTx) ReplaceCertificates(certs []cluster.Certificate) error
- func (n *NodeTx) ReplaceRaftNodes(nodes []RaftNode) error
- func (n *NodeTx) UpdateConfig(values map[string]string) error
- type RaftNode
- type RaftRole
- type StorageBucket
- type StorageBucketFilter
- type StorageBucketKey
- type StorageBucketKeyFilter
- type StoragePoolNode
- type StoragePoolState
- type StoragePoolVolumeBackup
- type StorageVolume
- type StorageVolumeArgs
- type StorageVolumeFilter
Constants ¶
const ( ClusterMemberStateCreated = 0 ClusterMemberStatePending = 1 ClusterMemberStateEvacuated = 2 )
Numeric type codes identifying different cluster member states.
const ( RaftVoter = client.Voter RaftStandBy = client.StandBy RaftSpare = client.Spare )
RaftNode roles.
const ( StoragePoolVolumeTypeContainer = iota StoragePoolVolumeTypeImage StoragePoolVolumeTypeCustom StoragePoolVolumeTypeVM )
XXX: this was extracted from storage_volume_utils.go, we find a way to factor it independently from both the db and main packages.
const ( StoragePoolVolumeTypeNameContainer string = "container" StoragePoolVolumeTypeNameVM string = "virtual-machine" StoragePoolVolumeTypeNameImage string = "image" StoragePoolVolumeTypeNameCustom string = "custom" )
Leave the string type in here! This guarantees that go treats this is as a typed string constant. Removing it causes go to treat these as untyped string constants which is not what we want.
const ( StoragePoolVolumeContentTypeFS = iota StoragePoolVolumeContentTypeBlock StoragePoolVolumeContentTypeISO )
Content types.
const ( StoragePoolVolumeContentTypeNameFS string = "filesystem" StoragePoolVolumeContentTypeNameBlock string = "block" StoragePoolVolumeContentTypeNameISO string = "iso" )
Content type names.
const ClusterRoleDatabase = ClusterRole("database")
ClusterRoleDatabase represents the database role in a cluster.
const ClusterRoleDatabaseLeader = ClusterRole("database-leader")
ClusterRoleDatabaseLeader represents the database leader role in a cluster.
const ClusterRoleDatabaseStandBy = ClusterRole("database-standby")
ClusterRoleDatabaseStandBy represents the database stand-by role in a cluster.
const ClusterRoleEventHub = ClusterRole("event-hub")
ClusterRoleEventHub represents a cluster member who operates as an event hub.
const ClusterRoleOVNChassis = ClusterRole("ovn-chassis")
ClusterRoleOVNChassis represents a cluster member who operates as an OVN chassis.
const DefaultOfflineThreshold = 20
DefaultOfflineThreshold is the default value for the cluster.offline_threshold configuration key, expressed in seconds.
Variables ¶
var ( // ErrAlreadyDefined hapens when the given entry already exists, // for example a container. ErrAlreadyDefined = fmt.Errorf("The record already exists") // ErrNoClusterMember is used to indicate no cluster member has been found for a resource. ErrNoClusterMember = fmt.Errorf("No cluster member found") )
var ClusterRoles = map[int]ClusterRole{ 1: ClusterRoleEventHub, 2: ClusterRoleOVNChassis, }
ClusterRoles maps role ids into human-readable names.
Note: the database role is currently stored directly in the raft configuration which acts as single source of truth for it. This map should only contain Incus-specific cluster roles.
var ErrInstanceListStop = fmt.Errorf("search stopped")
ErrInstanceListStop used as return value from InstanceList's instanceFunc when prematurely stopping the search.
var ErrSomeNodesAreBehind = fmt.Errorf("some nodes are behind this node's version")
ErrSomeNodesAreBehind is returned by OpenCluster if some of the nodes in the cluster have a schema or API version that is less recent than this node.
var ErrUnknownEntityID = fmt.Errorf("Unknown entity ID")
ErrUnknownEntityID describes the unknown entity ID error.
var ImageSourceProtocol = map[int]string{
0: "incus",
1: "direct",
2: "simplestreams",
}
ImageSourceProtocol maps image source protocol codes to human-readable names.
var NodeSpecificNetworkConfig = []string{
"bgp.ipv4.nexthop",
"bgp.ipv6.nexthop",
"bridge.external_interfaces",
"parent",
}
NodeSpecificNetworkConfig lists all network config keys which are node-specific.
var NodeSpecificStorageConfig = []string{
"size",
"source",
"source.wipe",
"volatile.initial_source",
"zfs.pool_name",
"lvm.thinpool_name",
"lvm.vg_name",
}
NodeSpecificStorageConfig lists all storage pool config keys which are node-specific.
var StoragePoolVolumeTypeNames = map[int]string{ StoragePoolVolumeTypeContainer: "container", StoragePoolVolumeTypeImage: "image", StoragePoolVolumeTypeCustom: "custom", StoragePoolVolumeTypeVM: "virtual-machine", }
StoragePoolVolumeTypeNames represents a map of storage volume types and their names.
var StorageRemoteDriverNames func() []string
StorageRemoteDriverNames returns a list of remote storage driver names.
Functions ¶
func ClusterGroupToAPI ¶
func ClusterGroupToAPI(clusterGroup *cluster.ClusterGroup, nodes []string) *api.ClusterGroup
ClusterGroupToAPI is a convenience to convert a ClusterGroup db struct into an API cluster group struct.
func CreateInstanceConfig ¶
CreateInstanceConfig inserts a new config for the instance with the given ID.
func DqliteLatestSegment ¶
DqliteLatestSegment returns the latest segment ID in the global database.
func ExpandInstanceConfig ¶
ExpandInstanceConfig expands the given instance config with the config values of the given profiles.
func ExpandInstanceDevices ¶
func ExpandInstanceDevices(devices deviceConfig.Devices, profiles []api.Profile) deviceConfig.Devices
ExpandInstanceDevices expands the given instance devices with the devices defined in the given profiles.
func NetworkStateToAPIStatus ¶
func NetworkStateToAPIStatus(state NetworkState) string
NetworkStateToAPIStatus converts DB NetworkState to API status string.
func NewTestDqliteServer ¶
NewTestDqliteServer creates a new test dqlite server.
Return the directory backing the test server and a newly created server store that can be used to connect to it.
func StoragePoolStateToAPIStatus ¶
func StoragePoolStateToAPIStatus(state StoragePoolState) string
StoragePoolStateToAPIStatus converts DB StoragePoolState to API status string.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster mediates access to data stored in the cluster dqlite database.
func ForLocalInspection ¶
ForLocalInspection is a aid for the hack in initializeDbObject, which sets the db-related Deamon attributes upfront, to be backward compatible with the legacy patches that need to interact with the database.
func ForLocalInspectionWithPreparedStmts ¶
ForLocalInspectionWithPreparedStmts is the same as ForLocalInspection but it also prepares the statements used in auto-generated database code.
func NewTestCluster ¶
NewTestCluster creates a new Cluster for testing purposes, along with a function that can be used to clean it up when done.
func OpenCluster ¶
func OpenCluster(closingCtx context.Context, name string, store driver.NodeStore, address, dir string, timeout time.Duration, options ...driver.Option) (*Cluster, error)
OpenCluster creates a new Cluster object for interacting with the dqlite database.
- name: Basename of the database file holding the data. Typically "db.bin". - dialer: Function used to connect to the dqlite backend via gRPC SQL. - address: Network address of this node (or empty string). - dir: Base database directory (e.g. /var/lib/incus/database) - timeout: Give up trying to open the database after this amount of time.
The address and api parameters will be used to determine if the cluster database matches our version, and possibly trigger a schema update. If the schema update can't be performed right now, because some nodes are still behind, an Upgrading error is returned. Accepts a closingCtx context argument used to indicate when the daemon is shutting down.
func (*Cluster) AddImageToLocalNode ¶
AddImageToLocalNode creates a new entry in the images_nodes table for tracking that the local member has the given image.
func (*Cluster) CopyDefaultImageProfiles ¶
CopyDefaultImageProfiles copies default profiles from id to new_id.
func (*Cluster) CreateImage ¶
func (c *Cluster) CreateImage(project string, fp string, fname string, sz int64, public bool, autoUpdate bool, architecture string, createdAt time.Time, expiresAt time.Time, properties map[string]string, typeName string, profileIds []int64) error
CreateImage creates a new image.
func (*Cluster) CreateImageSource ¶
func (c *Cluster) CreateImageSource(id int, server string, protocol string, certificate string, alias string) error
CreateImageSource inserts a new image source.
func (*Cluster) CreateInstanceBackup ¶
func (c *Cluster) CreateInstanceBackup(args InstanceBackup) error
CreateInstanceBackup creates a new backup.
func (*Cluster) CreateNetwork ¶
func (c *Cluster) CreateNetwork(projectName string, name string, description string, netType NetworkType, config map[string]string) (int64, error)
CreateNetwork creates a new network.
func (*Cluster) CreateNetworkACL ¶
CreateNetworkACL creates a new Network ACL.
func (*Cluster) CreateNetworkForward ¶
func (c *Cluster) CreateNetworkForward(networkID int64, memberSpecific bool, info *api.NetworkForwardsPost) (int64, error)
CreateNetworkForward creates a new Network Forward. If memberSpecific is true, then the forward is associated to the current member, rather than being associated to all members.
func (*Cluster) CreateNetworkLoadBalancer ¶
func (c *Cluster) CreateNetworkLoadBalancer(networkID int64, memberSpecific bool, info *api.NetworkLoadBalancersPost) (int64, error)
CreateNetworkLoadBalancer creates a new Network Load Balancer. If memberSpecific is true, then the load balancer is associated to the current member, rather than being associated to all members.
func (*Cluster) CreateNetworkPeer ¶
func (c *Cluster) CreateNetworkPeer(networkID int64, info *api.NetworkPeersPost) (int64, bool, error)
CreateNetworkPeer creates a new Network Peer and returns its ID. If there is a mutual peering on the target network side the both peer entries are upated to link to each other's repspective network ID. Returns the local peer ID and true if a mutual peering has been created.
func (*Cluster) CreateNetworkZone ¶
CreateNetworkZone creates a new Network zone.
func (*Cluster) CreateNetworkZoneRecord ¶
func (c *Cluster) CreateNetworkZoneRecord(zone int64, info api.NetworkZoneRecordsPost) (int64, error)
CreateNetworkZoneRecord creates a new network zone record.
func (*Cluster) CreateStoragePool ¶
func (c *Cluster) CreateStoragePool(poolName string, poolDescription string, poolDriver string, poolConfig map[string]string) (int64, error)
CreateStoragePool creates new storage pool. Also creates a local member entry with state storagePoolPending.
func (*Cluster) CreateStoragePoolBucket ¶
func (c *Cluster) CreateStoragePoolBucket(ctx context.Context, poolID int64, projectName string, memberSpecific bool, info api.StorageBucketsPost) (int64, error)
CreateStoragePoolBucket creates a new Storage Bucket. If memberSpecific is true, then the storage bucket is associated to the current member, rather than being associated to all members.
func (*Cluster) CreateStoragePoolBucketKey ¶
func (c *Cluster) CreateStoragePoolBucketKey(ctx context.Context, bucketID int64, info api.StorageBucketKeysPost) (int64, error)
CreateStoragePoolBucketKey creates a new Storage Bucket Key.
func (*Cluster) CreateStoragePoolVolume ¶
func (c *Cluster) CreateStoragePoolVolume(projectName string, volumeName string, volumeDescription string, volumeType int, poolID int64, volumeConfig map[string]string, contentType int, creationDate time.Time) (int64, error)
CreateStoragePoolVolume creates a new storage volume attached to a given storage pool.
func (*Cluster) CreateStoragePoolVolumeBackup ¶
func (c *Cluster) CreateStoragePoolVolumeBackup(args StoragePoolVolumeBackup) error
CreateStoragePoolVolumeBackup creates a new storage volume backup.
func (*Cluster) CreateStorageVolumeSnapshot ¶
func (c *Cluster) CreateStorageVolumeSnapshot(projectName string, volumeName string, volumeDescription string, volumeType int, poolID int64, volumeConfig map[string]string, creationDate time.Time, expiryDate time.Time) (int64, error)
CreateStorageVolumeSnapshot creates a new storage volume snapshot attached to a given storage pool.
func (*Cluster) DB ¶
DB returns the low level database handle to the cluster database.
FIXME: this is used for compatibility with some legacy code, and should be dropped once there are no call sites left.
func (*Cluster) DeleteImage ¶
DeleteImage deletes the image with the given ID.
func (*Cluster) DeleteInstance ¶
DeleteInstance removes the instance with the given name from the database.
func (*Cluster) DeleteInstanceBackup ¶
DeleteInstanceBackup removes the instance backup with the given name from the database.
func (*Cluster) DeleteInstanceConfigKey ¶
DeleteInstanceConfigKey removes the given key from the config of the instance with the given ID.
func (*Cluster) DeleteNetwork ¶
DeleteNetwork deletes the network with the given name.
func (*Cluster) DeleteNetworkACL ¶
DeleteNetworkACL deletes the Network ACL.
func (*Cluster) DeleteNetworkForward ¶
DeleteNetworkForward deletes an existing Network Forward.
func (*Cluster) DeleteNetworkLoadBalancer ¶
DeleteNetworkLoadBalancer deletes an existing Network Load Balancer.
func (*Cluster) DeleteNetworkPeer ¶
DeleteNetworkPeer deletes an existing Network Peer.
func (*Cluster) DeleteNetworkZone ¶
DeleteNetworkZone deletes the Network zone.
func (*Cluster) DeleteNetworkZoneRecord ¶
DeleteNetworkZoneRecord deletes the network zone record.
func (*Cluster) DeleteReadyStateFromLocalInstances ¶
DeleteReadyStateFromLocalInstances deletes the volatile.last_state.ready config key from all local instances.
func (*Cluster) DeleteStoragePoolBucket ¶
DeleteStoragePoolBucket deletes an existing Storage Bucket.
func (*Cluster) DeleteStoragePoolBucketKey ¶
func (c *Cluster) DeleteStoragePoolBucketKey(ctx context.Context, bucketID int64, keyID int64) error
DeleteStoragePoolBucketKey deletes an existing Storage Bucket Key.
func (*Cluster) DeleteStoragePoolVolumeBackup ¶
DeleteStoragePoolVolumeBackup removes the storage volume backup with the given name from the database.
func (*Cluster) EnterExclusive ¶
EnterExclusive acquires a lock on the cluster db, so any successive call to Transaction will block until ExitExclusive has been called.
func (*Cluster) ExitExclusive ¶
func (c *Cluster) ExitExclusive(ctx context.Context, f func(context.Context, *ClusterTx) error) error
ExitExclusive runs the given transaction and then releases the lock acquired with EnterExclusive.
func (*Cluster) GetCreatedNetworks ¶
GetCreatedNetworks returns the names of all networks that are in state networkCreated.
func (*Cluster) GetCreatedStoragePoolNames ¶
GetCreatedStoragePoolNames returns the names of all storage pools that are created.
func (*Cluster) GetExpiredInstanceBackups ¶
func (c *Cluster) GetExpiredInstanceBackups() ([]InstanceBackup, error)
GetExpiredInstanceBackups returns a list of expired instance backups.
func (*Cluster) GetImage ¶
func (c *Cluster) GetImage(fingerprintPrefix string, filter cluster.ImageFilter) (int, *api.Image, error)
GetImage gets an Image object from the database.
The fingerprint argument will be queried with a LIKE query, means you can pass a shortform and will get the full fingerprint. However in case the shortform matches more than one image, an error will be returned. publicOnly, when true, will return the image only if it is public; a false value will return any image matching the fingerprint prefix.
func (*Cluster) GetImageFromAnyProject ¶
GetImageFromAnyProject returns an image matching the given fingerprint, if it exists in any project.
func (*Cluster) GetImagesOnLocalNode ¶
GetImagesOnLocalNode returns all images that the local server holds.
func (*Cluster) GetImagesOnNode ¶
GetImagesOnNode returns all images that the node with the given id has.
func (*Cluster) GetInstanceBackup ¶
func (c *Cluster) GetInstanceBackup(projectName string, name string) (InstanceBackup, error)
GetInstanceBackup returns the backup with the given name.
func (*Cluster) GetInstanceBackupWithID ¶
func (c *Cluster) GetInstanceBackupWithID(backupID int) (InstanceBackup, error)
GetInstanceBackupWithID returns the backup with the given ID.
func (*Cluster) GetInstanceBackups ¶
GetInstanceBackups returns the names of all backups of the instance with the given name.
func (*Cluster) GetInstanceConfig ¶
GetInstanceConfig returns the value of the given key in the configuration of the instance with the given ID.
func (*Cluster) GetInstanceID ¶
GetInstanceID returns the ID of the instance with the given name.
func (*Cluster) GetInstancePool ¶
GetInstancePool returns the storage pool of a given instance.
This is a non-transactional variant of ClusterTx.GetInstancePool().
func (*Cluster) GetInstanceProjectAndName ¶
GetInstanceProjectAndName returns the project and the name of the instance with the given ID.
func (*Cluster) GetInstanceSnapshotID ¶
GetInstanceSnapshotID returns the ID of the snapshot with the given name.
func (*Cluster) GetInstanceSnapshotsNames ¶
GetInstanceSnapshotsNames returns the names of all snapshots of the instance in the given project with the given name. Returns snapshots slice ordered by when they were created, oldest first.
func (*Cluster) GetInstancesWithProfile ¶
GetInstancesWithProfile gets the names of the instance associated with the profile with the given name in the given project.
func (*Cluster) GetLocalStoragePoolVolumeSnapshotsWithType ¶
func (c *Cluster) GetLocalStoragePoolVolumeSnapshotsWithType(projectName string, volumeName string, volumeType int, poolID int64) ([]StorageVolumeArgs, error)
GetLocalStoragePoolVolumeSnapshotsWithType get all snapshots of a storage volume attached to a given storage pool of a given volume type, on the local member. Returns snapshots slice ordered by when they were created, oldest first.
func (*Cluster) GetNetworkACL ¶
GetNetworkACL returns the Network ACL with the given name in the given project.
func (*Cluster) GetNetworkACLIDsByNames ¶
GetNetworkACLIDsByNames returns a map of names to IDs of existing Network ACLs.
func (*Cluster) GetNetworkACLNameAndProjectWithID ¶
GetNetworkACLNameAndProjectWithID returns the network ACL name and project name for the given ID.
func (*Cluster) GetNetworkACLs ¶
GetNetworkACLs returns the names of existing Network ACLs.
func (*Cluster) GetNetworkForward ¶
func (c *Cluster) GetNetworkForward(ctx context.Context, networkID int64, memberSpecific bool, listenAddress string) (int64, *api.NetworkForward, error)
GetNetworkForward returns the Network Forward ID and info for the given network ID and listen address. If memberSpecific is true, then the search is restricted to forwards that belong to this member or belong to all members.
func (*Cluster) GetNetworkForwardListenAddresses ¶
func (c *Cluster) GetNetworkForwardListenAddresses(networkID int64, memberSpecific bool) (map[int64]string, error)
GetNetworkForwardListenAddresses returns map of Network Forward Listen Addresses for the given network ID keyed on Forward ID. If memberSpecific is true, then the search is restricted to forwards that belong to this member or belong to all members.
func (*Cluster) GetNetworkForwards ¶
func (c *Cluster) GetNetworkForwards(ctx context.Context, networkID int64, memberSpecific bool, listenAddresses ...string) (map[int64]*api.NetworkForward, error)
GetNetworkForwards returns map of Network Forwards for the given network ID keyed on Forward ID. If memberSpecific is true, then the search is restricted to forwards that belong to this member or belong to all members. Can optionally retrieve only specific network forwards by listen address.
func (*Cluster) GetNetworkInAnyState ¶
func (c *Cluster) GetNetworkInAnyState(projectName string, networkName string) (int64, *api.Network, map[int64]NetworkNode, error)
GetNetworkInAnyState returns the network with the given name. The network can be in any state. Returns network ID, network info, and network cluster member info.
func (*Cluster) GetNetworkLoadBalancer ¶
func (c *Cluster) GetNetworkLoadBalancer(ctx context.Context, networkID int64, memberSpecific bool, listenAddress string) (int64, *api.NetworkLoadBalancer, error)
GetNetworkLoadBalancer returns the Network Load Balancer ID and info for the given network ID and listen address. If memberSpecific is true, then the search is restricted to load balancers that belong to this member or belong to all members.
func (*Cluster) GetNetworkLoadBalancerListenAddresses ¶
func (c *Cluster) GetNetworkLoadBalancerListenAddresses(networkID int64, memberSpecific bool) (map[int64]string, error)
GetNetworkLoadBalancerListenAddresses returns map of Network Load Balancer Listen Addresses for the given network ID keyed on Load Balancer ID. If memberSpecific is true, then the search is restricted to load balancers that belong to this member or belong to all members.
func (*Cluster) GetNetworkLoadBalancers ¶
func (c *Cluster) GetNetworkLoadBalancers(ctx context.Context, networkID int64, memberSpecific bool, listenAddresses ...string) (map[int64]*api.NetworkLoadBalancer, error)
GetNetworkLoadBalancers returns map of Network Load Balancers for the given network ID keyed on Load Balancer ID. If memberSpecific is true, then the search is restricted to load balancers that belong to this member or belong to all members. Can optionally retrieve only specific network load balancers by listen address.
func (*Cluster) GetNetworkNameAndProjectWithID ¶
GetNetworkNameAndProjectWithID returns the network name and project name for the given ID.
func (*Cluster) GetNetworkPeer ¶
GetNetworkPeer returns the Network Peer ID and info for the given network ID and peer name.
func (*Cluster) GetNetworkPeerNames ¶
GetNetworkPeerNames returns map of Network Peer names for the given network ID keyed on Peer ID.
func (*Cluster) GetNetworkPeers ¶
GetNetworkPeers returns map of Network Peers for the given network ID keyed on Peer ID.
func (*Cluster) GetNetworkPeersTargetNetworkIDs ¶
func (c *Cluster) GetNetworkPeersTargetNetworkIDs(projectName string, networkType NetworkType) (map[NetworkPeer]int64, error)
GetNetworkPeersTargetNetworkIDs returns a map of peer connections to target network IDs for networks in the specified project and network type.
func (*Cluster) GetNetworkWithInterface ¶
GetNetworkWithInterface returns the network associated with the interface with the given name.
func (*Cluster) GetNetworkZone ¶
GetNetworkZone returns the Network zone with the given name.
func (*Cluster) GetNetworkZoneByProject ¶
func (c *Cluster) GetNetworkZoneByProject(projectName string, name string) (int64, *api.NetworkZone, error)
GetNetworkZoneByProject returns the Network zone with the given name in the given project.
func (*Cluster) GetNetworkZoneKeys ¶
GetNetworkZoneKeys returns a map of key names to keys.
func (*Cluster) GetNetworkZoneRecord ¶
func (c *Cluster) GetNetworkZoneRecord(zone int64, name string) (int64, *api.NetworkZoneRecord, error)
GetNetworkZoneRecord returns the network zone record for the given zone and name.
func (*Cluster) GetNetworkZoneRecordNames ¶
GetNetworkZoneRecordNames returns the names of existing Network zone records.
func (*Cluster) GetNetworkZonesByProject ¶
GetNetworkZonesByProject returns the names of existing Network zones.
func (*Cluster) GetNetworks ¶
GetNetworks returns the names of existing networks.
func (*Cluster) GetNextInstanceSnapshotIndex ¶
GetNextInstanceSnapshotIndex returns the index that the next snapshot of the instance with the given name and pattern should have.
func (*Cluster) GetNextStorageVolumeSnapshotIndex ¶
GetNextStorageVolumeSnapshotIndex returns the index of the next snapshot of the storage volume with the given name should have.
Note, the code below doesn't deal with snapshots of snapshots. To do that, we'll need to weed out based on # slashes in names.
func (*Cluster) GetNodesWithImage ¶
GetNodesWithImage returns the addresses of online nodes which already have the image.
func (*Cluster) GetNodesWithImageAndAutoUpdate ¶
func (c *Cluster) GetNodesWithImageAndAutoUpdate(fingerprint string, autoUpdate bool) ([]string, error)
GetNodesWithImageAndAutoUpdate returns the addresses of online nodes which already have the image.
func (*Cluster) GetNodesWithoutImage ¶
GetNodesWithoutImage returns the addresses of online nodes which don't have the image.
func (*Cluster) GetPoolNamesFromIDs ¶
GetPoolNamesFromIDs get the names of the storage pools with the given IDs.
func (*Cluster) GetPoolsWithImage ¶
GetPoolsWithImage get the IDs of all storage pools on which a given image exists.
func (*Cluster) GetProfile ¶
GetProfile returns the profile with the given name.
func (*Cluster) GetProfileNames ¶
GetProfileNames returns the names of all profiles in the given project.
func (*Cluster) GetProfiles ¶
GetProfiles returns the profiles with the given names in the given project.
func (*Cluster) GetStoragePool ¶
func (c *Cluster) GetStoragePool(poolName string) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
GetStoragePool returns a single storage pool.
The pool must be in the created stated, not pending.
func (*Cluster) GetStoragePoolDrivers ¶
GetStoragePoolDrivers returns the names of all storage drivers currently being used by at least one storage pool.
func (*Cluster) GetStoragePoolID ¶
GetStoragePoolID returns the id of a single storage pool.
func (*Cluster) GetStoragePoolInAnyState ¶
func (c *Cluster) GetStoragePoolInAnyState(poolName string) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
GetStoragePoolInAnyState returns the storage pool with the given name.
The pool can be in any state.
func (*Cluster) GetStoragePoolNames ¶
GetStoragePoolNames returns the names of all storage pools.
func (*Cluster) GetStoragePoolNodeVolumeID ¶
func (c *Cluster) GetStoragePoolNodeVolumeID(projectName string, volumeName string, volumeType int, poolID int64) (int64, error)
GetStoragePoolNodeVolumeID gets the ID of a storage volume on a given storage pool of a given storage volume type and project, on the current node.
func (*Cluster) GetStoragePoolVolumeBackup ¶
func (c *Cluster) GetStoragePoolVolumeBackup(projectName string, poolName string, backupName string) (StoragePoolVolumeBackup, error)
GetStoragePoolVolumeBackup returns the volume backup with the given name.
func (*Cluster) GetStoragePoolVolumeBackupWithID ¶
func (c *Cluster) GetStoragePoolVolumeBackupWithID(backupID int) (StoragePoolVolumeBackup, error)
GetStoragePoolVolumeBackupWithID returns the volume backup with the given ID.
func (*Cluster) GetStoragePoolVolumeBackups ¶
func (c *Cluster) GetStoragePoolVolumeBackups(projectName string, volumeName string, poolID int64) ([]StoragePoolVolumeBackup, error)
GetStoragePoolVolumeBackups returns a list of volume backups.
func (*Cluster) GetStoragePoolVolumeBackupsNames ¶
func (c *Cluster) GetStoragePoolVolumeBackupsNames(projectName string, volumeName string, poolID int64) ([]string, error)
GetStoragePoolVolumeBackupsNames returns the names of all backups of the storage volume with the given name.
func (*Cluster) GetStoragePoolWithID ¶
func (c *Cluster) GetStoragePoolWithID(poolID int) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
GetStoragePoolWithID returns the storage pool with the given ID.
func (*Cluster) GetStoragePools ¶
func (c *Cluster) GetStoragePools(ctx context.Context, state *StoragePoolState, poolNames ...string) (map[int64]api.StoragePool, map[int64]map[int64]StoragePoolNode, error)
GetStoragePools returns map of Storage Pools keyed on ID and Storage Pool member info keyed on ID and Member ID. Can optionally accept a state filter, if nil, then pools in any state are returned. Can optionally accept one or more poolNames to further filter the returned pools.
func (*Cluster) GetStorageVolumeSnapshotExpiry ¶
GetStorageVolumeSnapshotExpiry gets the expiry date of a storage volume snapshot.
func (*Cluster) GetStorageVolumeSnapshotWithID ¶
func (c *Cluster) GetStorageVolumeSnapshotWithID(snapshotID int) (StorageVolumeArgs, error)
GetStorageVolumeSnapshotWithID returns the volume snapshot with the given ID.
func (*Cluster) GetURIFromEntity ¶
GetURIFromEntity returns the URI for the given entity type and entity ID.
func (*Cluster) ImageExists ¶
ImageExists returns whether an image with the given fingerprint exists.
func (*Cluster) ImageIsReferencedByOtherProjects ¶
func (c *Cluster) ImageIsReferencedByOtherProjects(project string, fingerprint string) (bool, error)
ImageIsReferencedByOtherProjects returns true if the image with the given fingerprint is referenced by projects other than the given one.
func (*Cluster) InstanceList ¶
func (c *Cluster) InstanceList(ctx context.Context, instanceFunc func(inst InstanceArgs, project api.Project) error, filters ...cluster.InstanceFilter) error
InstanceList loads all instances across all projects and for each instance runs the instanceFunc passing in the instance and it's project and profiles. Accepts optional filter arguments to specify a subset of instances.
func (*Cluster) IsRemoteStorage ¶
IsRemoteStorage return whether a given pool is backed by remote storage.
func (*Cluster) LocalNodeIsEvacuated ¶
LocalNodeIsEvacuated returns whether the local member is in the evacuated state.
func (*Cluster) LocateImage ¶
LocateImage returns the address of an online node that has a local copy of the given image, or an empty string if the image is already available on this node.
If the image is not available on any online node, an error is returned.
func (*Cluster) MoveImageAlias ¶
MoveImageAlias changes the image ID associated with an alias.
func (*Cluster) NodeID ¶
NodeID sets the node NodeID associated with this cluster instance. It's used for backward-compatibility of all db-related APIs that were written before clustering and don't accept a node NodeID, so in those cases we automatically use this value as implicit node NodeID.
func (*Cluster) RemoveStoragePool ¶
func (c *Cluster) RemoveStoragePool(poolName string) (*api.StoragePool, error)
RemoveStoragePool deletes storage pool.
func (*Cluster) RemoveStoragePoolVolume ¶
func (c *Cluster) RemoveStoragePoolVolume(projectName string, volumeName string, volumeType int, poolID int64) error
RemoveStoragePoolVolume deletes the storage volume attached to a given storage pool.
func (*Cluster) RemoveUnreferencedProfiles ¶
RemoveUnreferencedProfiles removes unreferenced profiles.
func (*Cluster) RenameImageAlias ¶
RenameImageAlias renames the alias with the given ID.
func (*Cluster) RenameInstanceBackup ¶
RenameInstanceBackup renames an instance backup from the given current name to the new one.
func (*Cluster) RenameNetwork ¶
RenameNetwork renames a network.
func (*Cluster) RenameNetworkACL ¶
RenameNetworkACL renames a Network ACL.
func (*Cluster) RenameStoragePoolVolume ¶
func (c *Cluster) RenameStoragePoolVolume(projectName string, oldVolumeName string, newVolumeName string, volumeType int, poolID int64) error
RenameStoragePoolVolume renames the storage volume attached to a given storage pool.
func (*Cluster) RenameVolumeBackup ¶
RenameVolumeBackup renames a volume backup from the given current name to the new one.
func (*Cluster) SetImageCachedAndLastUseDate ¶
func (c *Cluster) SetImageCachedAndLastUseDate(projectName string, fingerprint string, lastUsed time.Time) error
SetImageCachedAndLastUseDate sets the cached and last_use_date field of the image with the given fingerprint.
func (*Cluster) Transaction ¶
Transaction creates a new ClusterTx object and transactionally executes the cluster database interactions invoked by the given function. If the function returns no error, all database changes are committed to the cluster database database, otherwise they are rolled back.
If EnterExclusive has been called before, calling Transaction will block until ExitExclusive has been called as well to release the lock.
func (*Cluster) UpdateImage ¶
func (c *Cluster) UpdateImage(id int, fname string, sz int64, public bool, autoUpdate bool, architecture string, createdAt time.Time, expiresAt time.Time, properties map[string]string, project string, profileIds []int64) error
UpdateImage updates the image with the given ID.
func (*Cluster) UpdateInstanceSnapshotCreationDate ¶
UpdateInstanceSnapshotCreationDate updates the creation_date field of the instance snapshot with ID.
func (*Cluster) UpdateInstanceStatefulFlag ¶
UpdateInstanceStatefulFlag toggles the stateful flag of the instance with the given ID.
func (*Cluster) UpdateNetwork ¶
func (c *Cluster) UpdateNetwork(project string, name, description string, config map[string]string) error
UpdateNetwork updates the network with the given name.
func (*Cluster) UpdateNetworkACL ¶
func (c *Cluster) UpdateNetworkACL(id int64, config *api.NetworkACLPut) error
UpdateNetworkACL updates the Network ACL with the given ID.
func (*Cluster) UpdateNetworkForward ¶
func (c *Cluster) UpdateNetworkForward(networkID int64, forwardID int64, info *api.NetworkForwardPut) error
UpdateNetworkForward updates an existing Network Forward.
func (*Cluster) UpdateNetworkLoadBalancer ¶
func (c *Cluster) UpdateNetworkLoadBalancer(networkID int64, loadBalancerID int64, info *api.NetworkLoadBalancerPut) error
UpdateNetworkLoadBalancer updates an existing Network Load Balancer.
func (*Cluster) UpdateNetworkPeer ¶
UpdateNetworkPeer updates an existing Network Peer.
func (*Cluster) UpdateNetworkZone ¶
func (c *Cluster) UpdateNetworkZone(id int64, config *api.NetworkZonePut) error
UpdateNetworkZone updates the Network zone with the given ID.
func (*Cluster) UpdateNetworkZoneRecord ¶
func (c *Cluster) UpdateNetworkZoneRecord(id int64, config api.NetworkZoneRecordPut) error
UpdateNetworkZoneRecord updates the network zone record with the given ID.
func (*Cluster) UpdateStoragePool ¶
func (c *Cluster) UpdateStoragePool(poolName, description string, poolConfig map[string]string) error
UpdateStoragePool updates a storage pool.
func (*Cluster) UpdateStoragePoolBucket ¶
func (c *Cluster) UpdateStoragePoolBucket(ctx context.Context, poolID int64, bucketID int64, info *api.StorageBucketPut) error
UpdateStoragePoolBucket updates an existing Storage Bucket.
func (*Cluster) UpdateStoragePoolBucketKey ¶
func (c *Cluster) UpdateStoragePoolBucketKey(ctx context.Context, bucketID int64, bucketKeyID int64, info *api.StorageBucketKeyPut) error
UpdateStoragePoolBucketKey updates an existing Storage Bucket Key.
func (*Cluster) UpdateStoragePoolVolume ¶
func (c *Cluster) UpdateStoragePoolVolume(projectName string, volumeName string, volumeType int, poolID int64, volumeDescription string, volumeConfig map[string]string) error
UpdateStoragePoolVolume updates the storage volume attached to a given storage pool.
func (*Cluster) UpdateStorageVolumeSnapshot ¶
func (c *Cluster) UpdateStorageVolumeSnapshot(projectName string, volumeName string, volumeType int, poolID int64, volumeDescription string, volumeConfig map[string]string, expiryDate time.Time) error
UpdateStorageVolumeSnapshot updates the storage volume snapshot attached to a given storage pool.
func (*Cluster) UpsertWarning ¶
func (c *Cluster) UpsertWarning(nodeName string, projectName string, entityTypeCode int, entityID int, typeCode warningtype.Type, message string) error
UpsertWarning creates or updates a warning.
func (*Cluster) UpsertWarningLocalNode ¶
func (c *Cluster) UpsertWarningLocalNode(projectName string, entityTypeCode int, entityID int, typeCode warningtype.Type, message string) error
UpsertWarningLocalNode creates or updates a warning for the local member. Returns error if no local member name.
type ClusterRole ¶
type ClusterRole string
ClusterRole represents the role of a member in a cluster.
type ClusterTx ¶
type ClusterTx struct {
// contains filtered or unexported fields
}
ClusterTx models a single interaction with a cluster database.
It wraps low-level sql.Tx objects and offers a high-level API to fetch and update data.
func NewTestClusterTx ¶
NewTestClusterTx returns a fresh ClusterTx object, along with a function that can be called to cleanup state when done with it.
func (*ClusterTx) AddNodeToClusterGroup ¶
func (c *ClusterTx) AddNodeToClusterGroup(ctx context.Context, groupName string, nodeName string) error
AddNodeToClusterGroup adds a given node to the given cluster group.
func (*ClusterTx) BootstrapNode ¶
BootstrapNode sets the name and address of the first cluster member, with id: 1.
func (*ClusterTx) CreateImageAlias ¶
func (c *ClusterTx) CreateImageAlias(ctx context.Context, projectName, aliasName string, imageID int, desc string) error
CreateImageAlias inserts an alias ento the database.
func (*ClusterTx) CreateInstanceConfig ¶
CreateInstanceConfig inserts a new config for the container with the given ID.
func (*ClusterTx) CreateNetworkConfig ¶
CreateNetworkConfig adds a new entry in the networks_config table.
func (*ClusterTx) CreateNode ¶
CreateNode adds a node to the current list of members that are part of the cluster. The node's architecture will be the architecture of the machine the method is being run on. It returns the ID of the newly inserted row.
func (*ClusterTx) CreateNodeWithArch ¶
CreateNodeWithArch is the same as NodeAdd, but lets setting the node architecture explicitly.
func (*ClusterTx) CreatePendingNetwork ¶
func (c *ClusterTx) CreatePendingNetwork(ctx context.Context, node string, projectName string, name string, netType NetworkType, conf map[string]string) error
CreatePendingNetwork creates a new pending network on the node with the given name.
func (*ClusterTx) CreatePendingStoragePool ¶
func (c *ClusterTx) CreatePendingStoragePool(ctx context.Context, node string, name string, driver string, conf map[string]string) error
CreatePendingStoragePool creates a new pending storage pool on the node with the given name.
func (*ClusterTx) CreateStoragePoolConfig ¶
CreateStoragePoolConfig adds a new entry in the storage_pools_config table.
func (*ClusterTx) DeleteImageAlias ¶
DeleteImageAlias deletes the alias with the given name.
func (*ClusterTx) DeleteInstanceConfigKey ¶
DeleteInstanceConfigKey removes the given key from the config of the instance with the given ID.
func (*ClusterTx) GetAllNodesWithOperations ¶
GetAllNodesWithOperations returns a list of nodes that have operations in any project.
func (*ClusterTx) GetCachedImageSourceFingerprint ¶
func (c *ClusterTx) GetCachedImageSourceFingerprint(ctx context.Context, server string, protocol string, alias string, typeName string, architecture int) (string, error)
GetCachedImageSourceFingerprint tries to find a source entry of a locally cached image that matches the given remote details (server, protocol and alias). Return the fingerprint linked to the matching entry, if any.
func (*ClusterTx) GetCandidateMembers ¶
func (c *ClusterTx) GetCandidateMembers(ctx context.Context, allMembers []NodeInfo, targetArchitectures []int, targetClusterGroup string, allowedClusterGroups []string, offlineThreshold time.Duration) ([]NodeInfo, error)
GetCandidateMembers returns cluster members that are online, in created state and don't need manual targeting. It excludes members that do not support any of the targetArchitectures (if non-nil) or not in targetClusterGroup (if non-empty). It also takes into account any restrictions on allowedClusterGroups (if non-nil).
func (*ClusterTx) GetClusterGroupNodes ¶
GetClusterGroupNodes returns a list of nodes of the given cluster group.
func (*ClusterTx) GetClusterGroupURIs ¶
func (c *ClusterTx) GetClusterGroupURIs(ctx context.Context, filter cluster.ClusterGroupFilter) ([]string, error)
GetClusterGroupURIs returns all available ClusterGroup URIs. generator: ClusterGroup URIs
func (*ClusterTx) GetClusterGroupsWithNode ¶
func (c *ClusterTx) GetClusterGroupsWithNode(ctx context.Context, nodeName string) ([]string, error)
GetClusterGroupsWithNode returns a list of cluster group names the given node belongs to.
func (*ClusterTx) GetCreatedNetworks ¶
func (c *ClusterTx) GetCreatedNetworks(ctx context.Context) (map[string]map[int64]api.Network, error)
GetCreatedNetworks returns a map of api.Network associated to project and network ID. Only networks that have are in state networkCreated are returned.
func (*ClusterTx) GetCreatedNetworksByProject ¶
func (c *ClusterTx) GetCreatedNetworksByProject(ctx context.Context, projectName string) (map[int64]api.Network, error)
GetCreatedNetworksByProject returns a map of api.Network in a project associated to network ID. Only networks that have are in state networkCreated are returned.
func (*ClusterTx) GetCustomVolumesInProject ¶
func (c *ClusterTx) GetCustomVolumesInProject(ctx context.Context, project string) ([]StorageVolumeArgs, error)
GetCustomVolumesInProject returns all custom volumes in the given project.
func (*ClusterTx) GetExpiredStorageVolumeBackups ¶
func (c *ClusterTx) GetExpiredStorageVolumeBackups(ctx context.Context) ([]StoragePoolVolumeBackup, error)
GetExpiredStorageVolumeBackups returns a list of expired storage volume backups.
func (*ClusterTx) GetExpiredStorageVolumeSnapshots ¶
func (c *ClusterTx) GetExpiredStorageVolumeSnapshots(ctx context.Context, memberSpecific bool) ([]StorageVolumeArgs, error)
GetExpiredStorageVolumeSnapshots returns a list of expired volume snapshots. If memberSpecific is true, then the search is restricted to volumes that belong to this member or belong to all members.
func (*ClusterTx) GetFailureDomainsNames ¶
GetFailureDomainsNames return a map associating failure domain IDs to their names.
func (*ClusterTx) GetImageAlias ¶
func (c *ClusterTx) GetImageAlias(ctx context.Context, projectName string, imageName string, isTrustedClient bool) (int, api.ImageAliasesEntry, error)
GetImageAlias returns the alias with the given name in the given project.
func (*ClusterTx) GetImageAliases ¶
GetImageAliases returns the names of the aliases of all images.
func (*ClusterTx) GetImageByFingerprintPrefix ¶
func (c *ClusterTx) GetImageByFingerprintPrefix(ctx context.Context, fingerprintPrefix string, filter cluster.ImageFilter) (int, *api.Image, error)
GetImageByFingerprintPrefix gets an Image object from the database.
The fingerprint argument will be queried with a LIKE query, means you can pass a shortform and will get the full fingerprint. However in case the shortform matches more than one image, an error will be returned. publicOnly, when true, will return the image only if it is public; a false value will return any image matching the fingerprint prefix.
func (*ClusterTx) GetImageSource ¶
GetImageSource returns the image source with the given ID.
func (*ClusterTx) GetImagesFingerprints ¶
func (c *ClusterTx) GetImagesFingerprints(ctx context.Context, projectName string, publicOnly bool) ([]string, error)
GetImagesFingerprints returns the names of all images (optionally only the public ones).
func (*ClusterTx) GetInstanceNames ¶
GetInstanceNames returns the names of all containers the given project.
func (*ClusterTx) GetInstancePool ¶
func (c *ClusterTx) GetInstancePool(ctx context.Context, projectName string, instanceName string) (string, error)
GetInstancePool returns the storage pool of a given instance (or snapshot).
func (*ClusterTx) GetInstanceSnapshotsWithName ¶
func (c *ClusterTx) GetInstanceSnapshotsWithName(ctx context.Context, project string, name string) ([]cluster.Instance, error)
GetInstanceSnapshotsWithName returns all snapshots of a given instance in date created order, oldest first.
func (*ClusterTx) GetInstancesByMemberAddress ¶
func (c *ClusterTx) GetInstancesByMemberAddress(ctx context.Context, offlineThreshold time.Duration, projects []string, instType instancetype.Type) (map[string][]Instance, error)
GetInstancesByMemberAddress returns the instances associated to each cluster member address. The member address of instances running on the local member is set to the empty string, to distinguish it from remote nodes. Instances whose member is down are added to the special address "0.0.0.0".
func (*ClusterTx) GetLocalExpiredInstanceSnapshots ¶
func (c *ClusterTx) GetLocalExpiredInstanceSnapshots(ctx context.Context) ([]cluster.InstanceSnapshot, error)
GetLocalExpiredInstanceSnapshots returns a list of expired snapshots.
func (*ClusterTx) GetLocalImagesFingerprints ¶
GetLocalImagesFingerprints returns the fingerprints of all local images.
func (*ClusterTx) GetLocalInstanceWithVsockID ¶
func (c *ClusterTx) GetLocalInstanceWithVsockID(ctx context.Context, vsockID int) (*cluster.Instance, error)
GetLocalInstanceWithVsockID returns all available instances with the given config key and value.
func (*ClusterTx) GetLocalInstancesInProject ¶
func (c *ClusterTx) GetLocalInstancesInProject(ctx context.Context, filter cluster.InstanceFilter) ([]cluster.Instance, error)
GetLocalInstancesInProject retuurns all instances of the given type on the local member in the given project. If projectName is empty then all instances in all projects are returned.
func (*ClusterTx) GetLocalNodeAddress ¶
GetLocalNodeAddress returns the address of the node this method is invoked on.
func (*ClusterTx) GetLocalNodeName ¶
GetLocalNodeName returns the name of the node this method is invoked on. Usually you should not use this function directly but instead use the cached State.ServerName value.
func (*ClusterTx) GetNetworkACLURIs ¶
func (c *ClusterTx) GetNetworkACLURIs(ctx context.Context, projectID int, project string) ([]string, error)
GetNetworkACLURIs returns the URIs for the network ACLs with the given project.
func (*ClusterTx) GetNetworkID ¶
func (c *ClusterTx) GetNetworkID(ctx context.Context, projectName string, name string) (int64, error)
GetNetworkID returns the ID of the network with the given name.
func (*ClusterTx) GetNetworkURIs ¶
func (c *ClusterTx) GetNetworkURIs(ctx context.Context, projectID int, project string) ([]string, error)
GetNetworkURIs returns the URIs for the networks with the given project.
func (*ClusterTx) GetNetworkZones ¶
GetNetworkZones returns the names of existing Network zones mapped to project name.
func (*ClusterTx) GetNetworksLocalConfig ¶
func (c *ClusterTx) GetNetworksLocalConfig(ctx context.Context) (map[string]map[string]string, error)
GetNetworksLocalConfig returns a map associating each network name to its node-specific config values on the local member (i.e. the ones where node_id equals the ID of the local member).
func (*ClusterTx) GetNodeAddressOfInstance ¶
func (c *ClusterTx) GetNodeAddressOfInstance(ctx context.Context, project string, name string, instType instancetype.Type) (string, error)
GetNodeAddressOfInstance returns the address of the node hosting the instance with the given name in the given project.
It returns the empty string if the container is hosted on this node.
func (*ClusterTx) GetNodeByAddress ¶
GetNodeByAddress returns the node with the given network address.
func (*ClusterTx) GetNodeByName ¶
GetNodeByName returns the node with the given name.
func (*ClusterTx) GetNodeFailureDomain ¶
GetNodeFailureDomain returns the failure domain associated with the node with the given ID.
func (*ClusterTx) GetNodeID ¶
GetNodeID gets the ID of the node associated with this cluster transaction.
func (*ClusterTx) GetNodeMaxVersion ¶
GetNodeMaxVersion returns the highest schema and API versions possible on the cluster.
func (*ClusterTx) GetNodeOfflineThreshold ¶
GetNodeOfflineThreshold returns the amount of time that needs to elapse after which a series of unsuccessful heartbeat will make the node be considered offline.
func (*ClusterTx) GetNodeWithID ¶
GetNodeWithID returns the node with the given ID.
func (*ClusterTx) GetNodeWithLeastInstances ¶
func (c *ClusterTx) GetNodeWithLeastInstances(ctx context.Context, members []NodeInfo) (*NodeInfo, error)
GetNodeWithLeastInstances returns the name of the member with the least number of instances that are either already created or being created with an operation.
func (*ClusterTx) GetNodes ¶
GetNodes returns all cluster members that are part of the cluster.
If this server is not clustered, a list with a single member whose address is 0.0.0.0 is returned.
func (*ClusterTx) GetNodesCount ¶
GetNodesCount returns the number of members in the cluster.
Since there's always at least one node row, even when not-clustered, the return value is greater than zero.
func (*ClusterTx) GetNodesFailureDomains ¶
GetNodesFailureDomains returns a map associating each node address with its failure domain code.
func (*ClusterTx) GetNodesWithOperations ¶
GetNodesWithOperations returns a list of nodes that have operations.
func (*ClusterTx) GetNonPendingNetworkIDs ¶
func (c *ClusterTx) GetNonPendingNetworkIDs(ctx context.Context) (map[string]map[string]int64, error)
GetNonPendingNetworkIDs returns a map associating each network name to its ID.
Pending networks are skipped.
func (*ClusterTx) GetNonPendingStoragePoolsNamesToIDs ¶
func (c *ClusterTx) GetNonPendingStoragePoolsNamesToIDs(ctx context.Context) (map[string]int64, error)
GetNonPendingStoragePoolsNamesToIDs returns a map associating each storage pool name to its ID.
Pending storage pools are skipped.
func (*ClusterTx) GetOperationsOfType ¶
func (c *ClusterTx) GetOperationsOfType(ctx context.Context, projectName string, opType operationtype.Type) ([]cluster.Operation, error)
GetOperationsOfType returns a list operations that belong to the specified project and have the desired type.
func (*ClusterTx) GetPendingNodeByAddress ¶
GetPendingNodeByAddress returns the pending node with the given network address.
func (*ClusterTx) GetProjectNetworkForwardListenAddressesByUplink ¶
func (c *ClusterTx) GetProjectNetworkForwardListenAddressesByUplink(ctx context.Context, uplinkNetworkName string, memberSpecific bool) (map[string]map[string][]string, error)
GetProjectNetworkForwardListenAddressesByUplink returns map of Network Forward Listen Addresses that belong to networks connected to the specified uplinkNetworkName. Returns a map keyed on project name and network name containing a slice of listen addresses.
func (*ClusterTx) GetProjectNetworkForwardListenAddressesOnMember ¶
func (c *ClusterTx) GetProjectNetworkForwardListenAddressesOnMember(ctx context.Context) (map[string]map[int64][]string, error)
GetProjectNetworkForwardListenAddressesOnMember returns map of Network Forward Listen Addresses that belong to to this specific cluster member. Will not include forwards that do not have a specific member. Returns a map keyed on project name and network ID containing a slice of listen addresses.
func (*ClusterTx) GetProjectNetworkLoadBalancerListenAddressesByUplink ¶
func (c *ClusterTx) GetProjectNetworkLoadBalancerListenAddressesByUplink(ctx context.Context, uplinkNetworkName string, memberSpecific bool) (map[string]map[string][]string, error)
GetProjectNetworkLoadBalancerListenAddressesByUplink returns map of Network Load Balancer Listen Addresses that belong to networks connected to the specified uplinkNetworkName. Returns a map keyed on project name and network name containing a slice of listen addresses.
func (*ClusterTx) GetProjectNetworkLoadBalancerListenAddressesOnMember ¶
func (c *ClusterTx) GetProjectNetworkLoadBalancerListenAddressesOnMember(ctx context.Context) (map[string]map[int64][]string, error)
GetProjectNetworkLoadBalancerListenAddressesOnMember returns map of Network Load Balancer Listen Addresses that belong to to this specific cluster member. Will not include load balancers that do not have a specific member. Returns a map keyed on project name and network ID containing a slice of listen addresses.
func (*ClusterTx) GetProjectsUsingImage ¶
func (c *ClusterTx) GetProjectsUsingImage(ctx context.Context, fingerprint string) ([]string, error)
GetProjectsUsingImage get the project names using an image by fingerprint.
func (*ClusterTx) GetStoragePoolBucket ¶
func (c *ClusterTx) GetStoragePoolBucket(ctx context.Context, poolID int64, projectName string, memberSpecific bool, bucketName string) (*StorageBucket, error)
GetStoragePoolBucket returns the Storage Bucket for the given Storage Pool ID, Project Name and Bucket Name. If memberSpecific is true, then the search is restricted to buckets that belong to this member or belong to all members.
func (*ClusterTx) GetStoragePoolBucketKey ¶
func (c *ClusterTx) GetStoragePoolBucketKey(ctx context.Context, bucketID int64, keyName string) (*StorageBucketKey, error)
GetStoragePoolBucketKey returns the Storage Bucket Key for the given Bucket ID and Key Name.
func (*ClusterTx) GetStoragePoolBucketKeys ¶
func (c *ClusterTx) GetStoragePoolBucketKeys(ctx context.Context, bucketID int64, filters ...StorageBucketKeyFilter) ([]*StorageBucketKey, error)
GetStoragePoolBucketKeys returns all storage buckets keys attached to a given storage bucket. If there are no bucket keys, it returns an empty list and no error. Accepts filters for narrowing down the results returned.
func (*ClusterTx) GetStoragePoolBuckets ¶
func (c *ClusterTx) GetStoragePoolBuckets(ctx context.Context, memberSpecific bool, filters ...StorageBucketFilter) ([]*StorageBucket, error)
GetStoragePoolBuckets returns all storage buckets. If there are no buckets, it returns an empty list and no error. Accepts filters for narrowing down the results returned. If memberSpecific is true, then the search is restricted to buckets that belong to this member or belong to all members.
func (*ClusterTx) GetStoragePoolDriver ¶
GetStoragePoolDriver returns the driver of the pool with the given ID.
func (*ClusterTx) GetStoragePoolID ¶
GetStoragePoolID returns the ID of the pool with the given name.
func (*ClusterTx) GetStoragePoolLocalBucket ¶
func (c *ClusterTx) GetStoragePoolLocalBucket(ctx context.Context, bucketName string) (*StorageBucket, error)
GetStoragePoolLocalBucket returns the local Storage Bucket for the given bucket name. The search is restricted to buckets that belong to this member.
func (*ClusterTx) GetStoragePoolLocalBucketByAccessKey ¶
func (c *ClusterTx) GetStoragePoolLocalBucketByAccessKey(ctx context.Context, accessKey string) (*StorageBucket, error)
GetStoragePoolLocalBucketByAccessKey returns the local Storage Bucket for the given bucket access key. The search is restricted to buckets that belong to this member.
func (*ClusterTx) GetStoragePoolNodeConfigs ¶
func (c *ClusterTx) GetStoragePoolNodeConfigs(ctx context.Context, poolID int64) (map[string]map[string]string, error)
GetStoragePoolNodeConfigs returns the node-specific configuration of all nodes grouped by node name, for the given poolID.
If the storage pool is not defined on all nodes, an error is returned.
func (*ClusterTx) GetStoragePoolVolume ¶
func (c *ClusterTx) GetStoragePoolVolume(ctx context.Context, poolID int64, projectName string, volumeType int, volumeName string, memberSpecific bool) (*StorageVolume, error)
GetStoragePoolVolume returns the storage volume attached to a given storage pool.
func (*ClusterTx) GetStoragePoolVolumeWithID ¶
func (c *ClusterTx) GetStoragePoolVolumeWithID(ctx context.Context, volumeID int) (StorageVolumeArgs, error)
GetStoragePoolVolumeWithID returns the volume with the given ID.
func (*ClusterTx) GetStoragePoolVolumes ¶
func (c *ClusterTx) GetStoragePoolVolumes(ctx context.Context, poolID int64, memberSpecific bool, filters ...StorageVolumeFilter) ([]*StorageVolume, error)
GetStoragePoolVolumes returns all storage volumes attached to a given storage pool. If there are no volumes, it returns an empty list and no error. Accepts filters for narrowing down the results returned. If memberSpecific is true, then the search is restricted to volumes that belong to this member or belong to all members.
func (*ClusterTx) GetStoragePoolVolumesWithType ¶
func (c *ClusterTx) GetStoragePoolVolumesWithType(ctx context.Context, volumeType int, memberSpecific bool) ([]StorageVolumeArgs, error)
GetStoragePoolVolumesWithType return a list of all volumes of the given type. If memberSpecific is true, then the search is restricted to volumes that belong to this member or belong to all members.
func (*ClusterTx) GetStoragePoolsLocalConfig ¶
func (c *ClusterTx) GetStoragePoolsLocalConfig(ctx context.Context) (map[string]map[string]string, error)
GetStoragePoolsLocalConfig returns a map associating each storage pool name to its node-specific config values (i.e. the ones where node_id is not NULL).
func (*ClusterTx) GetStorageVolumeNodes ¶
func (c *ClusterTx) GetStorageVolumeNodes(ctx context.Context, poolID int64, projectName string, volumeName string, volumeType int) ([]NodeInfo, error)
GetStorageVolumeNodes returns the node info of all nodes on which the volume with the given name is defined. The volume name can be either a regular name or a volume snapshot name. If the volume is defined, but without a specific node, then the ErrNoClusterMember error is returned. If the volume is not found then an api.StatusError with code set to http.StatusNotFound is returned.
func (*ClusterTx) GetStorageVolumeURIs ¶
GetStorageVolumeURIs returns the URIs of the storage volumes, specifying target node if applicable.
func (*ClusterTx) InstancesToInstanceArgs ¶
func (c *ClusterTx) InstancesToInstanceArgs(ctx context.Context, fillProfiles bool, instances ...cluster.Instance) (map[int]InstanceArgs, error)
InstancesToInstanceArgs converts many cluster.Instance to a map of InstanceArgs in as few queries as possible. Accepts fillProfiles argument that controls whether or not the returned InstanceArgs have their Profiles field populated. This avoids the need to load profile info from the database if it is already available in the caller's context and can be populated afterwards.
func (*ClusterTx) NetworkCreated ¶
NetworkCreated sets the state of the given network to networkCreated.
func (*ClusterTx) NetworkErrored ¶
NetworkErrored sets the state of the given network to networkErrored.
func (*ClusterTx) NetworkNodeConfigs ¶
func (c *ClusterTx) NetworkNodeConfigs(ctx context.Context, networkID int64) (map[string]map[string]string, error)
NetworkNodeConfigs returns the node-specific configuration of all nodes grouped by node name, for the given networkID.
If the network is not defined on all nodes, an error is returned.
func (*ClusterTx) NetworkNodeCreated ¶
NetworkNodeCreated sets the state of the given network for the local member to networkCreated.
func (*ClusterTx) NetworkNodeJoin ¶
NetworkNodeJoin adds a new entry in the networks_nodes table.
It should only be used when a new node joins the cluster, when it's safe to assume that the relevant network has already been created on the joining node, and we just need to track it.
func (*ClusterTx) NetworkNodes ¶
func (c *ClusterTx) NetworkNodes(ctx context.Context, networkID int64) (map[int64]NetworkNode, error)
NetworkNodes returns the nodes keyed by node ID that the given network is defined on.
func (*ClusterTx) NodeIsEmpty ¶
NodeIsEmpty returns an empty string if the node with the given ID has no instances or images associated with it. Otherwise, it returns a message say what's left.
func (*ClusterTx) NodeIsOutdated ¶
NodeIsOutdated returns true if there's some cluster node having an API or schema version greater than the node this method is invoked on.
func (*ClusterTx) RemoveNode ¶
RemoveNode removes the node with the given id.
func (*ClusterTx) RemoveNodeFromClusterGroup ¶
func (c *ClusterTx) RemoveNodeFromClusterGroup(ctx context.Context, groupName string, nodeName string) error
RemoveNodeFromClusterGroup removes a given node from the given group name.
func (*ClusterTx) RenameNode ¶
RenameNode changes the name of an existing node.
Return an error if a node with the same name already exists.
func (*ClusterTx) SetDescription ¶
SetDescription changes the description of the given node.
func (*ClusterTx) SetNodeHeartbeat ¶
SetNodeHeartbeat updates the heartbeat column of the node with the given address.
func (*ClusterTx) SetNodePendingFlag ¶
SetNodePendingFlag toggles the pending flag for the node. A node is pending when it's been accepted in the cluster, but has not yet actually joined it.
func (*ClusterTx) SetNodeVersion ¶
SetNodeVersion updates the schema and API version of the node with the given id. This is used only in tests.
func (*ClusterTx) StoragePoolCreated ¶
StoragePoolCreated sets the state of the given pool to storagePoolCreated.
func (*ClusterTx) StoragePoolErrored ¶
StoragePoolErrored sets the state of the given pool to storagePoolErrored.
func (*ClusterTx) StoragePoolNodeCreated ¶
StoragePoolNodeCreated sets the state of the given storage pool for the local member to storagePoolCreated.
func (*ClusterTx) UpdateCephStoragePoolAfterNodeJoin ¶
func (c *ClusterTx) UpdateCephStoragePoolAfterNodeJoin(ctx context.Context, poolID int64, nodeID int64) error
UpdateCephStoragePoolAfterNodeJoin updates internal state to reflect that nodeID is joining a cluster where poolID is a ceph pool.
func (*ClusterTx) UpdateClusterConfig ¶
UpdateClusterConfig updates the given cluster configuration keys in the config table. Config keys set to empty values will be deleted.
func (*ClusterTx) UpdateImageAlias ¶
func (c *ClusterTx) UpdateImageAlias(ctx context.Context, aliasID int, imageID int, desc string) error
UpdateImageAlias updates the alias with the given ID.
func (*ClusterTx) UpdateImageLastUseDate ¶
func (c *ClusterTx) UpdateImageLastUseDate(ctx context.Context, projectName string, fingerprint string, lastUsed time.Time) error
UpdateImageLastUseDate updates the last_use_date field of the image with the given fingerprint.
func (*ClusterTx) UpdateInstanceConfig ¶
UpdateInstanceConfig inserts/updates/deletes the provided keys.
func (*ClusterTx) UpdateInstanceLastUsedDate ¶
UpdateInstanceLastUsedDate updates the last_use_date field of the instance with the given ID.
func (*ClusterTx) UpdateInstanceNode ¶
func (c *ClusterTx) UpdateInstanceNode(ctx context.Context, project string, oldName string, newName string, newMemberName string, poolID int64, volumeType int) error
UpdateInstanceNode changes the name of an instance and the cluster member hosting it. It's meant to be used when moving a non-running instance backed by ceph from one cluster node to another.
func (*ClusterTx) UpdateInstancePowerState ¶
UpdateInstancePowerState sets the power state of the container with the given ID.
func (*ClusterTx) UpdateInstanceSnapshot ¶
UpdateInstanceSnapshot updates the description and expiry date of the instance snapshot with the given ID.
func (*ClusterTx) UpdateInstanceSnapshotConfig ¶
UpdateInstanceSnapshotConfig inserts/updates/deletes the provided config keys.
func (*ClusterTx) UpdateNetwork ¶
UpdateNetwork updates the network with the given ID.
func (*ClusterTx) UpdateNodeClusterGroups ¶
UpdateNodeClusterGroups changes the list of cluster groups the member belongs to.
func (*ClusterTx) UpdateNodeConfig ¶
UpdateNodeConfig updates the replaces the node's config with the specified config.
func (*ClusterTx) UpdateNodeFailureDomain ¶
UpdateNodeFailureDomain changes the failure domain of a node.
func (*ClusterTx) UpdateNodeRoles ¶
func (c *ClusterTx) UpdateNodeRoles(id int64, roles []ClusterRole) error
UpdateNodeRoles changes the list of roles on a member.
func (*ClusterTx) UpdateNodeStatus ¶
UpdateNodeStatus changes the state of a node.
func (*ClusterTx) UpdateStoragePoolAfterNodeJoin ¶
UpdateStoragePoolAfterNodeJoin adds a new entry in the storage_pools_nodes table.
It should only be used when a new node joins the cluster, when it's safe to assume that the relevant pool has already been created on the joining node, and we just need to track it.
func (*ClusterTx) UpdateStorageVolumeNode ¶ added in v0.2.0
func (c *ClusterTx) UpdateStorageVolumeNode(ctx context.Context, projectName string, oldName string, newName string, newMemberName string, poolID int64, volumeType int) error
UpdateStorageVolumeNode changes the name of a storage volume and the cluster member hosting it. It's meant to be used when moving a storage volume backed by ceph from one cluster node to another.
func (*ClusterTx) UpdateWarningState ¶
func (c *ClusterTx) UpdateWarningState(UUID string, message string, status warningtype.Status) error
UpdateWarningState updates the warning message and status with the given ID.
func (*ClusterTx) UpdateWarningStatus ¶
func (c *ClusterTx) UpdateWarningStatus(UUID string, status warningtype.Status) error
UpdateWarningStatus updates the status of the warning with the given UUID.
type DB ¶
DB represents access to global and local databases.
func (*DB) GetProject ¶
GetProject returns the project with the given key.
func (*DB) UpdateCertificate ¶
func (db *DB) UpdateCertificate(ctx context.Context, fingerprint string, cert cluster.Certificate, projectNames []string) error
UpdateCertificate updates a certificate in the db.
type InstanceArgs ¶
type InstanceArgs struct { // Don't set manually ID int Node string Type instancetype.Type Snapshot bool // Creation only Project string BaseImage string CreationDate time.Time Architecture int Config map[string]string Description string Devices deviceConfig.Devices Ephemeral bool LastUsedDate time.Time Name string Profiles []api.Profile Stateful bool ExpiryDate time.Time }
InstanceArgs is a value object holding all db-related details about an instance.
type InstanceBackup ¶
type InstanceBackup struct { ID int InstanceID int Name string CreationDate time.Time ExpiryDate time.Time InstanceOnly bool OptimizedStorage bool CompressionAlgorithm string }
InstanceBackup is a value object holding all db-related details about an instance backup.
type NetworkNode ¶
type NetworkNode struct { ID int64 Name string State NetworkState }
NetworkNode represents a network node.
type NetworkPeer ¶
NetworkPeer represents a peer connection.
type NetworkState ¶
type NetworkState int
NetworkState indicates the state of the network or network node.
type NetworkType ¶
type NetworkType int
NetworkType indicates type of network.
const ( NetworkTypeBridge NetworkType = iota // Network type bridge. NetworkTypeMacvlan // Network type macvlan. NetworkTypeSriov // Network type sriov. NetworkTypeOVN // Network type ovn. NetworkTypePhysical // Network type physical. )
Network types.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node mediates access to data stored in the node-local SQLite database.
func DirectAccess ¶
DirectAccess is a bit of a hack which allows getting a database Node struct from any standard Go sql.DB. This is primarily used to access the "db.bin" read-only copy of the database during startup.
func NewTestNode ¶
NewTestNode creates a new Node for testing purposes, along with a function that can be used to clean it up when done.
func OpenNode ¶
OpenNode creates a new Node object.
The fresh hook parameter is used by the daemon to mark all known patch names as applied when a brand new database is created.
Return the newly created Node object.
func (*Node) DB ¶
DB returns the low level database handle to the node-local SQLite database.
FIXME: this is used for compatibility with some legacy code, and should be dropped once there are no call sites left.
func (*Node) GetAppliedPatches ¶
GetAppliedPatches returns the names of all patches currently applied on this node.
func (*Node) MarkPatchAsApplied ¶
MarkPatchAsApplied marks the patch with the given name as applied on this node.
func (*Node) Transaction ¶
Transaction creates a new NodeTx object and transactionally executes the node-level database interactions invoked by the given function. If the function returns no error, all database changes are committed to the node-level database, otherwise they are rolled back.
type NodeInfo ¶
type NodeInfo struct { ID int64 // Stable node identifier Name string // User-assigned name of the node Address string // Network address of the node Description string // Node description (optional) Schema int // Schema version of the daemon running the member APIExtensions int // Number of API extensions of the daemon running the member Heartbeat time.Time // Timestamp of the last heartbeat Roles []ClusterRole // List of cluster roles Architecture int // Node architecture State int // Node state Config map[string]string // Configuration for the node Groups []string // Cluster groups }
NodeInfo holds information about a single member in a cluster.
func (NodeInfo) IsOffline ¶
IsOffline returns true if the last successful heartbeat time of the node is older than the given threshold.
func (NodeInfo) ToAPI ¶
func (n NodeInfo) ToAPI(ctx context.Context, tx *ClusterTx, args NodeInfoArgs) (*api.ClusterMember, error)
ToAPI returns an API entry.
type NodeInfoArgs ¶
type NodeInfoArgs struct { LeaderAddress string FailureDomains map[uint64]string MemberFailureDomains map[string]uint64 OfflineThreshold time.Duration MaxMemberVersion [2]int RaftNodes []RaftNode }
NodeInfoArgs provides information about the cluster environment for use with NodeInfo.ToAPI().
type NodeTx ¶
type NodeTx struct {
// contains filtered or unexported fields
}
NodeTx models a single interaction with a server-local database.
It wraps low-level sql.Tx objects and offers a high-level API to fetch and update data.
func NewTestNodeTx ¶
NewTestNodeTx returns a fresh NodeTx object, along with a function that can be called to cleanup state when done with it.
func (*NodeTx) CreateFirstRaftNode ¶
CreateFirstRaftNode adds a the first node of the cluster. It ensures that the database ID is 1, to match the server ID of the first raft log entry.
This method is supposed to be called when there are no rows in raft_nodes, and it will replace whatever existing row has ID 1.
func (*NodeTx) CreateRaftNode ¶
CreateRaftNode adds a node to the current list of nodes that are part of the dqlite Raft cluster. It returns the ID of the newly inserted row.
func (*NodeTx) GetCertificates ¶
GetCertificates returns all available local certificates.
func (*NodeTx) GetRaftNodeAddress ¶
GetRaftNodeAddress returns the address of the raft node with the given ID, if any matching row exists.
func (*NodeTx) GetRaftNodeAddresses ¶
GetRaftNodeAddresses returns the addresses of all servers that are members of the dqlite Raft cluster (possibly including the local member). If this server is not running in clustered mode, an empty list is returned.
func (*NodeTx) GetRaftNodes ¶
GetRaftNodes returns information about all cluster members that are members of the dqlite Raft cluster (possibly including the local member). If this server is not running in clustered mode, an empty list is returned.
func (*NodeTx) RemoveRaftNode ¶
RemoveRaftNode removes a node from the current list of nodes that are part of the dqlite Raft cluster.
func (*NodeTx) ReplaceCertificates ¶
func (n *NodeTx) ReplaceCertificates(certs []cluster.Certificate) error
ReplaceCertificates removes all existing certificates from the local certificates table and replaces them with the ones provided.
func (*NodeTx) ReplaceRaftNodes ¶
ReplaceRaftNodes replaces the current list of raft nodes.
type RaftNode ¶
RaftNode holds information about a single node in the dqlite raft cluster.
This is just a convenience alias for the equivalent data structure in the dqlite client package.
type StorageBucket ¶
type StorageBucket struct { api.StorageBucket ID int64 Project string PoolID int64 PoolName string }
StorageBucket represents a database storage bucket record.
type StorageBucketFilter ¶
StorageBucketFilter used for filtering storage buckets with GetStorageBuckets().
type StorageBucketKey ¶
type StorageBucketKey struct { api.StorageBucketKey ID int64 }
StorageBucketKey represents a database storage bucket key record.
type StorageBucketKeyFilter ¶
type StorageBucketKeyFilter struct {
Name *string
}
StorageBucketKeyFilter used for filtering storage bucket keys with GetStoragePoolBucketKeys().
type StoragePoolNode ¶
type StoragePoolNode struct { ID int64 Name string State StoragePoolState }
StoragePoolNode represents a storage pool node.
type StoragePoolState ¶
type StoragePoolState int
StoragePoolState indicates the state of the storage pool or storage pool node.
const ( StoragePoolPending StoragePoolState = iota // Storage pool defined but not yet created globally or on specific node. StoragePoolCreated // Storage pool created globally or on specific node. )
Storage pools state.
type StoragePoolVolumeBackup ¶
type StoragePoolVolumeBackup struct { ID int VolumeID int64 Name string CreationDate time.Time ExpiryDate time.Time VolumeOnly bool OptimizedStorage bool CompressionAlgorithm string }
StoragePoolVolumeBackup is a value object holding all db-related details about a storage volume backup.
type StorageVolume ¶
type StorageVolume struct { api.StorageVolume ID int64 }
StorageVolume represents a database storage volume record.
type StorageVolumeArgs ¶
type StorageVolumeArgs struct { ID int64 Name string // At least one of Type or TypeName must be set. Type int TypeName string // At least one of PoolID or PoolName must be set. PoolID int64 PoolName string Snapshot bool Config map[string]string Description string CreationDate time.Time ExpiryDate time.Time // At least on of ProjectID or ProjectName must be set. ProjectID int64 ProjectName string ContentType string NodeID int64 }
StorageVolumeArgs is a value object holding all db-related details about a storage volume.
type StorageVolumeFilter ¶
StorageVolumeFilter used for filtering storage volumes with GetStoragePoolVolumes().
Source Files ¶
- backups.go
- certificates.go
- cluster.go
- config.go
- db.go
- entity.go
- errors.go
- images.go
- instances.go
- network_acls.go
- network_forwards.go
- network_load_balancers.go
- network_peers.go
- network_zones.go
- networks.go
- node.go
- operations.go
- patches.go
- profiles.go
- projects.go
- raft.go
- schema.go
- snapshots.go
- storage_buckets.go
- storage_pools.go
- storage_volume_snapshots.go
- storage_volumes.go
- testing.go
- transaction.go
- warnings.go
Directories ¶
Path | Synopsis |
---|---|
file
Package file contains helpers to write auto-generated Go source files.
|
Package file contains helpers to write auto-generated Go source files. |
Package query implements helpers around database/sql to execute various kinds of very common SQL queries.
|
Package query implements helpers around database/sql to execute various kinds of very common SQL queries. |
Package schema offers utilities to create and maintain a database schema.
|
Package schema offers utilities to create and maintain a database schema. |