fdbadminclient

package
v2.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminClient

type AdminClient interface {
	// GetStatus gets the database's status.
	GetStatus() (*fdbv1beta2.FoundationDBStatus, error)

	// ConfigureDatabase sets the database configuration.
	ConfigureDatabase(configuration fdbv1beta2.DatabaseConfiguration, newDatabase bool) error

	// ExcludeProcesses starts evacuating processes so that they can be removed
	// from the database.
	ExcludeProcesses(addresses []fdbv1beta2.ProcessAddress) error

	// ExcludeProcessesWithNoWait starts evacuating processes so that they can be removed from the database. If noWait is
	// set to true, the exclude command will not block until all data is moved away from the processes.
	ExcludeProcessesWithNoWait(addresses []fdbv1beta2.ProcessAddress, noWait bool) error

	// IncludeProcesses removes processes from the exclusion list and allows
	// them to take on roles again.
	IncludeProcesses(addresses []fdbv1beta2.ProcessAddress) error

	// GetExclusions gets a list of the addresses currently excluded from the
	// database.
	GetExclusions() ([]fdbv1beta2.ProcessAddress, error)

	// KillProcesses restarts processes
	KillProcesses(addresses []fdbv1beta2.ProcessAddress) error

	// KillProcessesForUpgrade restarts processes for upgrades, this will issue 2 kill commands to make sure all
	// processes are restarted.
	KillProcessesForUpgrade(addresses []fdbv1beta2.ProcessAddress) error

	// ChangeCoordinators changes the coordinator set
	ChangeCoordinators(addresses []fdbv1beta2.ProcessAddress) (string, error)

	// VersionSupported reports whether we can support a cluster with a given
	// version.
	VersionSupported(version string) (bool, error)

	// GetProtocolVersion determines the protocol version that is used by a
	// version of FDB.
	GetProtocolVersion(version string) (string, error)

	// StartBackup starts a new backup.
	StartBackup(url string, snapshotPeriodSeconds int, encyptionKeyPath string) error

	// StopBackup stops a backup.
	StopBackup(url string) error

	// PauseBackups pauses the backups.
	PauseBackups() error

	// ResumeBackups resumes the backups.
	ResumeBackups() error

	// ModifyBackup modifies the configuration of the backup.
	ModifyBackup(int) error

	// GetBackupStatus gets the status of the current backup.
	GetBackupStatus() (*fdbv1beta2.FoundationDBLiveBackupStatus, error)

	// StartRestore starts a new restore.
	StartRestore(
		url string,
		keyRanges []fdbv1beta2.FoundationDBKeyRange,
		encyptionKeyPath string,
	) error

	// GetRestoreStatus gets the status of the current restore.
	GetRestoreStatus() (string, error)

	// Close shuts down any resources for the client once it is no longer
	// needed.
	Close() error

	// SetKnobs sets the Knobs that should be used for the commandline call.
	SetKnobs([]string)

	// SetMaintenanceZone places zone into maintenance mode.
	SetMaintenanceZone(zone string, timeoutSeconds int) error

	// ResetMaintenanceMode resets the maintenance mode.
	ResetMaintenanceMode() error

	// WithValues will update the logger used by the current AdminClient to contain the provided key value pairs. The provided
	// arguments must be even.
	WithValues(keysAndValues ...interface{})

	// SetTimeout will overwrite the default timeout for interacting the FDB cluster.
	SetTimeout(timeout time.Duration)

	// GetProcessesUnderMaintenance will return all process groups that are currently stored to be under maintenance.
	// The result is a map with the process group ID as key and the start of the maintenance as value.
	GetProcessesUnderMaintenance() (map[fdbv1beta2.ProcessGroupID]int64, error)

	// RemoveProcessesUnderMaintenance will remove the provided process groups from the list of processes that
	// are planned to be taken down for maintenance. If a process group is not present in the list it will be ignored.
	RemoveProcessesUnderMaintenance([]fdbv1beta2.ProcessGroupID) error

	// SetProcessesUnderMaintenance will add the provided process groups to the list of processes that will be taken
	// down for maintenance. The value will be the provided time stamp. If a process group is already present in the
	// list, the timestamp will be updated.
	SetProcessesUnderMaintenance([]fdbv1beta2.ProcessGroupID, int64) error

	// GetVersionFromReachableCoordinators will return the running version based on the reachable coordinators. This method
	// can be used during version incompatible upgrades and based on the responses of the coordinators, this method will
	// assume the current running version of the cluster. If the fdbcli calls for none of the provided version return
	// a majority of reachable coordinators, the default version from the cluster.Status.RunningVersion will be returned.
	GetVersionFromReachableCoordinators() string

	// UpdatePendingForRemoval updates the set of process groups that are marked for removal, an update can be either the addition or removal of a process group.
	UpdatePendingForRemoval(map[fdbv1beta2.ProcessGroupID]fdbv1beta2.UpdateAction) error

	// UpdatePendingForExclusion updates the set of process groups that should be excluded, an update can be either the addition or removal of a process group.
	UpdatePendingForExclusion(map[fdbv1beta2.ProcessGroupID]fdbv1beta2.UpdateAction) error

	// UpdatePendingForInclusion updates the set of process groups that should be included, an update can be either the addition or removal of a process group.
	UpdatePendingForInclusion(map[fdbv1beta2.ProcessGroupID]fdbv1beta2.UpdateAction) error

	// UpdatePendingForRestart updates the set of process groups that should be restarted, an update can be either the addition or removal of a process group.
	UpdatePendingForRestart(map[fdbv1beta2.ProcessGroupID]fdbv1beta2.UpdateAction) error

	// UpdateReadyForExclusion updates the set of process groups that are ready to be excluded, an update can be either the addition or removal of a process group.
	UpdateReadyForExclusion(map[fdbv1beta2.ProcessGroupID]fdbv1beta2.UpdateAction) error

	// UpdateReadyForInclusion updates the set of process groups that are ready to be included, an update can be either the addition or removal of a process group.
	UpdateReadyForInclusion(map[fdbv1beta2.ProcessGroupID]fdbv1beta2.UpdateAction) error

	// UpdateReadyForRestart updates the set of process groups that are ready to be restarted, an update can be either the addition or removal of a process group
	UpdateReadyForRestart(map[fdbv1beta2.ProcessGroupID]fdbv1beta2.UpdateAction) error

	// UpdateProcessAddresses updates the process addresses for the specified process group ID. If the provided slice is empty or nil, the entry will be deleted.
	UpdateProcessAddresses(map[fdbv1beta2.ProcessGroupID][]string) error

	// GetPendingForRemoval gets the process group IDs for all process groups that are marked for removal.
	GetPendingForRemoval(prefix string) (map[fdbv1beta2.ProcessGroupID]time.Time, error)

	// GetPendingForExclusion gets the process group IDs for all process groups that should be excluded.
	GetPendingForExclusion(prefix string) (map[fdbv1beta2.ProcessGroupID]time.Time, error)

	// GetPendingForInclusion gets the process group IDs for all the process groups that should be included.
	GetPendingForInclusion(prefix string) (map[fdbv1beta2.ProcessGroupID]time.Time, error)

	// GetPendingForRestart gets the process group IDs for all the process groups that should be restarted.
	GetPendingForRestart(prefix string) (map[fdbv1beta2.ProcessGroupID]time.Time, error)

	// GetReadyForExclusion gets the process group IDs for all the process groups that are ready to be excluded.
	GetReadyForExclusion(prefix string) (map[fdbv1beta2.ProcessGroupID]time.Time, error)

	// GetReadyForInclusion gets the process group IDs for all the process groups that are ready to be included.
	GetReadyForInclusion(prefix string) (map[fdbv1beta2.ProcessGroupID]time.Time, error)

	// GetReadyForRestart gets the process group IDs for all the process groups that are ready to be restarted.
	GetReadyForRestart(prefix string) (map[fdbv1beta2.ProcessGroupID]time.Time, error)

	// GetProcessAddresses gets the process group IDs and their associated process addresses.
	GetProcessAddresses(prefix string) (map[fdbv1beta2.ProcessGroupID][]string, error)

	// ClearReadyForRestart removes all the process group IDs for all the process groups that are ready to be restarted.
	ClearReadyForRestart() error
}

AdminClient describes an interface for running administrative commands on a cluster

type DatabaseClientProvider

type DatabaseClientProvider interface {
	// GetLockClient generates a client for working with locks through the database.
	GetLockClient(cluster *fdbv1beta2.FoundationDBCluster) (LockClient, error)

	// GetLockClientWithLogger generates a client for working with locks through the database.
	// The provided logger will be used as logger for the LockClient.
	GetLockClientWithLogger(
		cluster *fdbv1beta2.FoundationDBCluster,
		logger logr.Logger,
	) (LockClient, error)

	// GetAdminClient generates a client for performing administrative actions
	// against the database.
	GetAdminClient(
		cluster *fdbv1beta2.FoundationDBCluster,
		kubernetesClient client.Client,
	) (AdminClient, error)

	// GetAdminClientWithLogger generates a client for performing administrative actions
	// against the database. The provided logger will be used as logger for the AdminClient.
	GetAdminClientWithLogger(
		cluster *fdbv1beta2.FoundationDBCluster,
		kubernetesClient client.Client,
		logger logr.Logger,
	) (AdminClient, error)
}

DatabaseClientProvider provides an abstraction for creating clients that communicate with the database.

type LockClient

type LockClient interface {
	// Disabled determines whether the locking is disabled.
	Disabled() bool

	// TakeLock attempts to acquire a lock.
	TakeLock() error

	// ReleaseLock will release the current lock. The method will only release the lock if the current
	// operator is the lock holder.
	ReleaseLock() error

	// AddPendingUpgrades registers information about which process groups are
	// pending an upgrade to a new version.
	AddPendingUpgrades(
		version fdbv1beta2.Version,
		processGroupIDs []fdbv1beta2.ProcessGroupID,
	) error

	// GetPendingUpgrades returns the stored information about which process
	// groups are pending an upgrade to a new version.
	GetPendingUpgrades(version fdbv1beta2.Version) (map[fdbv1beta2.ProcessGroupID]bool, error)

	// ClearPendingUpgrades clears any stored information about pending
	// upgrades.
	ClearPendingUpgrades() error

	// GetDenyList retrieves the current deny list from the database.
	GetDenyList() ([]string, error)

	// UpdateDenyList updates the deny list to match a list of entries.
	UpdateDenyList(locks []fdbv1beta2.LockDenyListEntry) error
}

LockClient provides a client for getting locks on operations for a cluster.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL