model

package
v3.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompressNone = "NONE"
	EncryptNone  = "NONE"
)
View Source
const DefaultSocketTimeout = 10 * time.Minute

Variables

View Source
var (
	ErrAlreadyExists = fmt.Errorf("item already exists")
	ErrNotFound      = fmt.Errorf("item not found")
	ErrInUse         = fmt.Errorf("item is in use")
)
View Source
var StorageRetryPolicy = struct {
	models.RetryPolicy
	MaxBackoffDuration time.Duration
	MaxRequestTimeout  time.Duration
}{
	RetryPolicy: models.RetryPolicy{
		BaseTimeout: 1 * time.Second,
		MaxRetries:  100,
		Multiplier:  1.1,
	},
	MaxBackoffDuration: 2 * time.Minute,
	MaxRequestTimeout:  10 * time.Minute,
}

StorageRetryPolicy defines the global retry policy for storage operations. It is used in GCP, Azure and S3 client configurations.

Functions

This section is empty.

Types

type AerospikeCluster

type AerospikeCluster struct {

	// The cluster name.
	ClusterLabel *string
	// The seed nodes details.
	SeedNodes []SeedNode
	// The connection timeout.
	ConnTimeout *time.Duration
	// Whether should use "services-alternate" instead of "services" in info request during cluster tending.
	UseServicesAlternate *bool
	// The authentication details to the Aerospike cluster.
	Credentials *Credentials
	// The cluster TLS configuration.
	TLS *TLS
	// Specifies the maximum number of parallel scans per the cluster.
	MaxParallelScans *int
	// contains filtered or unexported fields
}

AerospikeCluster represents the configuration for an Aerospike cluster for backup.

func (*AerospikeCluster) GetAuthMode

func (c *AerospikeCluster) GetAuthMode() *string

GetAuthMode safely returns the authentication mode.

func (*AerospikeCluster) GetPassword

func (c *AerospikeCluster) GetPassword() *string

GetPassword tries to read and set the password once from the configured source. Returns the password value. If it fails to read the password, it will return nil and try to read again next time.

func (*AerospikeCluster) GetUser

func (c *AerospikeCluster) GetUser() *string

GetUser safely returns the username.

func (*AerospikeCluster) Hash

func (c *AerospikeCluster) Hash() string

Hash returns a unique string identifier for the AerospikeCluster.

type AzureADAuth

type AzureADAuth struct {
	// TenantID is the Azure AD tenant (directory) ID.
	TenantID string
	// ClientID is the application (client) ID registered in Azure AD.
	ClientID string
	// ClientSecret is the secret key for the application registered in Azure AD.
	ClientSecret string
}

AzureADAuth represents Azure Active Directory authentication for Azure Blob storage.

type AzureAuth

type AzureAuth interface {
	// contains filtered or unexported methods
}

AzureAuth represents the authentication methods for Azure Blob storage. This interface is implemented by AzureSharedKeyAuth and AzureADAuth.

type AzureSharedKeyAuth

type AzureSharedKeyAuth struct {
	// AccountName is the name of the Azure Storage account.
	AccountName string
	// AccountKey is the access key for the Azure Storage account.
	AccountKey string
}

AzureSharedKeyAuth represents shared key authentication for Azure Blob storage.

type AzureStorage

type AzureStorage struct {
	// Path is the root directory within the Azure Blob container where backups will be stored.
	Path string
	// Endpoint is the URL of the Azure Blob storage service.
	Endpoint string
	// ContainerName is the name of the Azure Blob container where backups will be stored.
	ContainerName string
	// Auth holds the authentication details for Azure Blob storage.
	// It can be nil or AzureSharedKeyAuth or AzureADAuth.
	Auth AzureAuth
	// SecretAgent configuration to fetch keyfile from a secret store (optional).
	SecretAgent *SecretAgent
	// MinPartSize is the minimum size in bytes of individual Azure Blob chunks.
	MinPartSize *int
	// StorageClass defines the storage class for data and metadata objects.
	StorageClass *StorageClass
}

AzureStorage represents the configuration for Azure Blob storage.

func (*AzureStorage) GetPath added in v3.1.0

func (s *AzureStorage) GetPath() string

func (*AzureStorage) GetStorageClass added in v3.1.0

func (s *AzureStorage) GetStorageClass() StorageClass

func (*AzureStorage) String

func (s *AzureStorage) String() string

type BackupConfig

type BackupConfig struct {
	AerospikeClusters map[string]*AerospikeCluster
	Storage           map[string]Storage // Storage is an interface
	BackupPolicies    map[string]*BackupPolicy
	BackupRoutines    map[string]*BackupRoutine
	SecretAgents      map[string]*SecretAgent
	// contains filtered or unexported fields
}

type BackupDetails

type BackupDetails struct {
	BackupMetadata // Backup metadata that is stored in metadata.yaml file

	Key     string
	Storage Storage
	Routine string
}

BackupDetails contains information about a backup.

func NewBackupDetails added in v3.1.0

func NewBackupDetails(md BackupMetadata, key string, storage Storage, routine string) BackupDetails

type BackupMetadata

type BackupMetadata struct {
	// The backup time in the ISO 8601 format.
	Created time.Time `yaml:"created" json:"created"`
	// The time the backup operation completed.
	Finished time.Time `yaml:"finished" json:"finished"`
	// The lower time bound of backup entities in the ISO 8601 format (for incremental backups).
	From time.Time `yaml:"from" json:"from"`
	// The namespace of a backup.
	Namespace string `yaml:"namespace" json:"namespace"`
	// The total number of records backed up.
	RecordCount uint64 `yaml:"record-count" json:"record-count"`
	// The size of the backup in bytes.
	ByteCount uint64 `yaml:"byte-count" json:"byte-count"`
	// The number of backup files created.
	FileCount uint64 `yaml:"file-count" json:"file-count"`
	// The number of secondary indexes backed up.
	SecondaryIndexCount uint64 `yaml:"secondary-index-count" json:"secondary-index-count"`
	// The number of UDF files backed up.
	UDFCount uint64 `yaml:"udf-count" json:"udf-count"`
	// Compression specifies the compression mode used for the backup (ZSTD or NONE).
	Compression string
	// Encryption specifies the encryption mode used for the backup (NONE, AES128, AES256).
	Encryption string
}

BackupMetadata is an internal container for storing backup metadata. It is stored as a separate metadata file within each backup.

func NewBackupMetadata added in v3.1.0

func NewBackupMetadata(
	stats *models.BackupStats,
	namespace string,
	from, startTime time.Time,
	backupPolicy *BackupPolicy,
) BackupMetadata

func NewMetadataFromBytes

func NewMetadataFromBytes(data []byte) (*BackupMetadata, error)

NewMetadataFromBytes creates a new Metadata object from a byte slice.

type BackupPolicy

type BackupPolicy struct {
	// Maximum number of scan calls to run in parallel.
	Parallel *int
	// Maximum number of threads to use for writing backup files.
	ParallelWrite *int
	// Socket timeout. If this value is 0, it is set to total-timeout.
	// If both are 0, there is no socket idle time limit.
	SocketTimeout *time.Duration
	// Total socket timeout. Default is 0, that is, no timeout.
	TotalTimeout *time.Duration
	// RetryPolicy defines the configuration for retry attempts in case of failures.
	RetryPolicy *models.RetryPolicy
	// Specifies how long to retain full and incremental backups.
	RetentionPolicy *RetentionPolicy
	// Do not back up any record data (metadata or bin data).
	NoRecords *bool
	// Do not back up any secondary index definitions.
	NoIndexes *bool
	// Do not back up any UDF modules.
	NoUdfs *bool
	// Back up Aerospike cluster configuration.
	WithClusterConfig *bool
	// Throttles backup write operations to the backup file(s) to not exceed the given
	// bandwidth in MiB/s.
	Bandwidth *int64
	// Limit total returned records per second (RPS). If RPS is zero (the default),
	// the records-per-second limit is not applied.
	RecordsPerSecond *int
	// File size limit (in MiB) for the backup directory. If an .asb backup file crosses this size threshold,
	// a new backup file will be created.
	FileLimit *int
	// Encryption details.
	EncryptionPolicy *EncryptionPolicy
	// Compression details.
	CompressionPolicy *CompressionPolicy
	// Sealed determines whether backup should include keys updated during the backup process.
	// When true, the backup contains only records that last modified before backup started.
	// When false (default), records updated during backup might be included in the backup, but it's not guaranteed.
	Sealed *bool
	// XDR configuration for MRT backups.
	// Commented out in dto.BackupPolicy, will always be nil.
	XDRConfig *XDRConfig
	// Allows incremental backups to run concurrently.
	ConcurrentIncremental *bool
}

BackupPolicy represents a scheduled backup policy.

func (*BackupPolicy) CopyWithNoRecords added in v3.1.0

func (p *BackupPolicy) CopyWithNoRecords() *BackupPolicy

CopyWithNoRecords creates a new instance of the BackupPolicy struct with identical field values. New instance has NoRecords set to true.

func (*BackupPolicy) GetFileLimitOrDefault

func (p *BackupPolicy) GetFileLimitOrDefault() int

func (*BackupPolicy) GetParallelOrDefault

func (p *BackupPolicy) GetParallelOrDefault() int

func (*BackupPolicy) GetParallelWriteOrDefault added in v3.3.1

func (p *BackupPolicy) GetParallelWriteOrDefault() int

func (*BackupPolicy) GetRetryPolicyOrDefault

func (p *BackupPolicy) GetRetryPolicyOrDefault() models.RetryPolicy

func (*BackupPolicy) IsSealedOrDefault

func (p *BackupPolicy) IsSealedOrDefault() bool

IsSealedOrDefault returns the value of the Sealed property. If the property is not set, it returns the default value.

type BackupRoutine

type BackupRoutine struct {
	// The name of the corresponding backup policy.
	BackupPolicy *BackupPolicy
	// The name of the corresponding source cluster.
	SourceCluster *AerospikeCluster
	// The name of the corresponding storage provider configuration.
	Storage Storage
	// The Secret Agent configuration for the routine (optional).
	SecretAgent *SecretAgent
	// The interval for full backup as a cron expression string.
	IntervalCron string
	// The interval for incremental backup as a cron expression string (optional).
	IncrIntervalCron string
	// The list of the namespaces to back up (optional, empty list implies backup up whole cluster).
	Namespaces []string
	// The list of backup set names (optional, an empty list implies backing up all sets).
	SetList []string
	// The list of backup bin names (optional, an empty list implies backing up all bins).
	BinList []string
	// A list of Aerospike Server rack IDs to prefer when reading records for a backup.
	PreferRacks []int
	// Back up list of partition filters. Partition filters can be ranges or individual partitions.
	// Default number of partitions to back up: 0 to 4095: all partitions.
	PartitionList string
	// NodeList contains a list of nodes to back up.
	NodeList []string
	// Whether this routine is disabled and should not run.
	Disabled bool
}

BackupRoutine represents a scheduled backup operation routine.

type BackupServiceConfig

type BackupServiceConfig struct {
	// HTTPServer is the backup service HTTP server configuration.
	HTTPServer *HTTPServerConfig
	// Logger is the backup service logger configuration.
	Logger *LoggerConfig
}

BackupServiceConfig represents the backup service configuration properties.

func (BackupServiceConfig) GetHTTPServerOrDefault

func (c BackupServiceConfig) GetHTTPServerOrDefault() *HTTPServerConfig

func (BackupServiceConfig) GetLoggerOrDefault

func (c BackupServiceConfig) GetLoggerOrDefault() *LoggerConfig

type BackupTime added in v3.1.0

type BackupTime struct {
	// contains filtered or unexported fields
}

BackupTime stores execution timestamps for both full and incremental backups.

func NewBackupTime added in v3.1.0

func NewBackupTime(lastFullBackup time.Time, lastIncrBackup time.Time) *BackupTime

func NewFullBackupTime added in v3.1.0

func NewFullBackupTime(lastFullBackup time.Time) *BackupTime

func NewNoBackupTime added in v3.1.0

func NewNoBackupTime() *BackupTime

func (*BackupTime) FullBackupTime added in v3.1.0

func (r *BackupTime) FullBackupTime() *time.Time

func (*BackupTime) IncrementalBackupTime added in v3.1.0

func (r *BackupTime) IncrementalBackupTime() *time.Time

func (*BackupTime) LatestRun added in v3.1.0

func (r *BackupTime) LatestRun() *time.Time

func (*BackupTime) NoFullBackup added in v3.1.0

func (r *BackupTime) NoFullBackup() bool

func (*BackupTime) SetFullBackupTime added in v3.1.0

func (r *BackupTime) SetFullBackupTime(t *time.Time)

func (*BackupTime) SetIncrementalBackupTime added in v3.1.0

func (r *BackupTime) SetIncrementalBackupTime(t *time.Time)

func (*BackupTime) String added in v3.1.0

func (r *BackupTime) String() string

type CompressionPolicy

type CompressionPolicy struct {
	// The compression mode to be used (default is NONE).
	Mode string
	// The compression level to use (or -1 if unspecified).
	Level int32
}

CompressionPolicy contains backup compression information.

type Config

type Config struct {
	ServiceConfig BackupServiceConfig
	// contains filtered or unexported fields
}

Config represents the service configuration.

func NewConfig

func NewConfig() *Config

func (*Config) AddCluster

func (c *Config) AddCluster(name string, cluster *AerospikeCluster) error

func (*Config) AddPolicy

func (c *Config) AddPolicy(name string, p *BackupPolicy) error

func (*Config) AddRoutine

func (c *Config) AddRoutine(name string, r *BackupRoutine) error

func (*Config) AddSecretAgent

func (c *Config) AddSecretAgent(name string, agent *SecretAgent) error

func (*Config) AddStorage

func (c *Config) AddStorage(name string, s Storage) error

func (*Config) BackupConfigCopy

func (c *Config) BackupConfigCopy() *BackupConfig

func (*Config) DeleteCluster

func (c *Config) DeleteCluster(name string) error

func (*Config) DeletePolicy

func (c *Config) DeletePolicy(name string) error

func (*Config) DeleteRoutine

func (c *Config) DeleteRoutine(name string) error

func (*Config) DeleteStorage

func (c *Config) DeleteStorage(name string) error

func (*Config) PopInvalidatedRoutines added in v3.1.0

func (c *Config) PopInvalidatedRoutines() []string

PopInvalidatedRoutines returns all invalidated routines since the last call.

func (*Config) Routine added in v3.1.0

func (c *Config) Routine(name string) (*BackupRoutine, bool)

func (*Config) Routines

func (c *Config) Routines() map[string]*BackupRoutine

func (*Config) SetBackupConfig

func (c *Config) SetBackupConfig(other *BackupConfig)

func (*Config) ToggleRoutineDisabled

func (c *Config) ToggleRoutineDisabled(name string, isDisabled bool) error

ToggleRoutineDisabled sets the Disabled field of the BackupRoutine based on the provided state.

func (*Config) UpdateCluster

func (c *Config) UpdateCluster(name string, cluster *AerospikeCluster) error

func (*Config) UpdatePolicy

func (c *Config) UpdatePolicy(name string, p *BackupPolicy) error

func (*Config) UpdateRoutine

func (c *Config) UpdateRoutine(name string, r *BackupRoutine) error

func (*Config) UpdateStorage

func (c *Config) UpdateStorage(name string, s Storage) error

type Credentials

type Credentials struct {
	// The username for the cluster authentication.
	User *string
	// The password for the cluster authentication.
	// It can be either plain text or path into the secret agent.
	Password *string
	// The file path with the password string, will take precedence over the password field.
	PasswordPath *string
	// The authentication mode string (INTERNAL, EXTERNAL, PKI).
	AuthMode *string
	// The name of the configured Secret Agent to use for authentication.
	SecretAgent *SecretAgent
}

Credentials represents authentication details to the Aerospike cluster.

func (*Credentials) String

func (c *Credentials) String() string

String returns a string representation of the Credentials.

type EncryptionPolicy

type EncryptionPolicy struct {
	// The encryption mode to be used (NONE, AES128, AES256)
	Mode string
	// The path to the file containing the encryption key.
	KeyFile *string
	// The name of the environment variable containing the encryption key.
	KeyEnv *string
	// The secret keyword in Aerospike Secret Agent containing the encryption key.
	KeySecret *string
}

EncryptionPolicy contains backup encryption information.

type FileLoggerConfig

type FileLoggerConfig struct {
	// Filename is the file to write logs to.
	Filename string
	// MaxSize is the maximum size in megabytes of the log file before it gets rotated.
	MaxSize int
	// MaxAge is the maximum number of days to retain old log files based on the
	// timestamp encoded in their filename. The default is not to remove old log files
	// based on age.
	MaxAge int
	// MaxBackups is the maximum number of old log files to retain. The default
	// is to retain all old log files.
	MaxBackups int
	// Compress determines if the rotated log files should be compressed
	// using gzip. The default is not to perform compression.
	Compress bool
}

FileLoggerConfig represents the configuration for the file logger writer.

func (*FileLoggerConfig) GetMaxSizeOrDefault

func (f *FileLoggerConfig) GetMaxSizeOrDefault() int

type GcpStorage

type GcpStorage struct {
	// KeyFile is the path to the JSON file containing the Google Cloud service account key.
	// This file is used for authentication with GCP services.
	KeyFile string
	// KeyJSON is the contents of the Google Cloud service account key.
	KeyJSON string
	// BucketName is the name of the GCP bucket where backups will be stored.
	BucketName string
	// Path is the root directory within the GCS bucket where backups will be stored.
	Path string
	// Endpoint is an alternative URL for the GCS API.
	// This should only be used for testing or in specific non-production scenarios.
	Endpoint string
	// SecretAgent configuration to fetch keyfile from a secret store (optional).
	SecretAgent *SecretAgent
	// MinPartSize is the minimum size in bytes of individual GCP storage chunks.
	MinPartSize *int
	// StorageClass defines the storage class for data and metadata objects.
	StorageClass *StorageClass
}

func (*GcpStorage) GetPath added in v3.1.0

func (s *GcpStorage) GetPath() string

func (*GcpStorage) GetStorageClass added in v3.1.0

func (s *GcpStorage) GetStorageClass() StorageClass

func (*GcpStorage) String

func (s *GcpStorage) String() string

type HTTPServerConfig

type HTTPServerConfig struct {
	// The address to listen on.
	Address *string
	// The port to listen on.
	Port *Port
	// HTTP rate limiter configuration.
	Rate *RateLimiterConfig
	// ContextPath customizes path for the API endpoints.
	ContextPath *string
	// Timeout for http server operations.
	Timeout *time.Duration
}

HTTPServerConfig represents the service's HTTP server configuration.

func (*HTTPServerConfig) GetAddressOrDefault

func (s *HTTPServerConfig) GetAddressOrDefault() string

GetAddressOrDefault returns the value of the Address property. If the property is not set, it returns the default value.

func (*HTTPServerConfig) GetContextPathOrDefault

func (s *HTTPServerConfig) GetContextPathOrDefault() string

GetContextPathOrDefault returns the value of the ContextPath property. If the property is not set, it returns the default value.

func (*HTTPServerConfig) GetPortOrDefault

func (s *HTTPServerConfig) GetPortOrDefault() Port

GetPortOrDefault returns the value of the Port property. If the property is not set, it returns the default value.

func (*HTTPServerConfig) GetRateOrDefault

func (s *HTTPServerConfig) GetRateOrDefault() *RateLimiterConfig

GetRateOrDefault returns the value of the Rate property. If the property is not set, it returns the default value.

func (*HTTPServerConfig) GetTimeoutOrDefault

func (s *HTTPServerConfig) GetTimeoutOrDefault() time.Duration

GetTimeoutOrDefault returns the value of the Timeout property. If the property is not set, it returns the default value = 5s.

type JobStatus

type JobStatus string
const (
	JobStatusRunning   JobStatus = "Running"
	JobStatusDone      JobStatus = "Done"
	JobStatusFailed    JobStatus = "Failed"
	JobStatusCancelled JobStatus = "Cancelled"
)

type LocalStorage

type LocalStorage struct {
	// Path is the root directory where backups will be stored locally.
	Path string
}

func (*LocalStorage) GetPath added in v3.1.0

func (s *LocalStorage) GetPath() string

func (*LocalStorage) GetStorageClass added in v3.1.0

func (s *LocalStorage) GetStorageClass() StorageClass

func (*LocalStorage) String

func (s *LocalStorage) String() string

type LoggerConfig

type LoggerConfig struct {
	// Level is the logger level.
	Level *string
	// Format is the logger format (PLAIN, JSON).
	Format *string
	// Whether to enable logging to the standard output.
	StdoutWriter *bool
	// File writer logging configuration.
	FileWriter *FileLoggerConfig
}

LoggerConfig represents the backup service logger configuration.

func (*LoggerConfig) GetFormatOrDefault

func (l *LoggerConfig) GetFormatOrDefault() string

GetFormatOrDefault returns the value of the Format property. If the property is not set, it returns the default value.

func (*LoggerConfig) GetLevelOrDefault

func (l *LoggerConfig) GetLevelOrDefault() string

GetLevelOrDefault returns the value of the Level property. If the property is not set, it returns the default value.

func (*LoggerConfig) GetStdoutWriterOrDefault

func (l *LoggerConfig) GetStdoutWriterOrDefault() bool

GetStdoutWriterOrDefault returns the value of the StdoutWriter property. If the property is not set, it returns the default value.

type Port added in v3.1.0

type Port int

Port represents a network port.

func NewPort added in v3.1.0

func NewPort(port int) *Port

type PortRange added in v3.1.0

type PortRange struct {
	Start Port
	End   Port
}

PortRange represents a range of network ports.

type RateLimiterConfig

type RateLimiterConfig struct {
	// Rate limiter tokens per second threshold.
	Tps *int
	// Rate limiter token bucket size (bursts threshold).
	Size *int
	// The list of ips to whitelist in rate limiting.
	WhiteList []string
}

RateLimiterConfig represents the service's HTTP server rate limiter configuration.

func (*RateLimiterConfig) GetSizeOrDefault

func (r *RateLimiterConfig) GetSizeOrDefault() int

GetSizeOrDefault returns the value of the Size property. If the property is not set, it returns the default value.

func (*RateLimiterConfig) GetTpsOrDefault

func (r *RateLimiterConfig) GetTpsOrDefault() int

GetTpsOrDefault returns the value of the Tps property. If the property is not set, it returns the default value.

func (*RateLimiterConfig) GetWhiteListOrDefault

func (r *RateLimiterConfig) GetWhiteListOrDefault() []string

GetWhiteListOrDefault returns the value of the WhiteList property. If the property is not set, it returns the default value.

type RestoreJobID

type RestoreJobID int64

RestoreJobID represents the restore operation job id.

type RestoreJobStatus

type RestoreJobStatus struct {
	Counters       *models.RestoreStats
	CurrentRestore *RunningJob
	Status         JobStatus
	Error          error
}

RestoreJobStatus represents a restore job status.

type RestoreNamespace

type RestoreNamespace struct {
	// Original namespace name.
	Source *string
	// Destination namespace name.
	Destination *string
}

RestoreNamespace specifies an alternative namespace name for the restore operation, where Source is the original namespace name and Destination is the namespace name to which the backup data is to be restored.

type RestorePolicy

type RestorePolicy struct {
	// The number of concurrent record readers from backup files. Default: 20
	Parallel *int
	// Do not restore any record data (metadata or bin data).
	// By default, record data, secondary index definitions, and UDF modules
	// will be restored.
	NoRecords *bool
	// Do not restore any secondary index definitions.
	NoIndexes *bool
	// Do not restore any UDF modules.
	NoUdfs *bool
	// Socket timeout for write transactions.
	SocketTimeout *time.Duration
	// Total socket timeout for write transactions.
	TotalTimeout *time.Duration
	// Disables the use of batch writes when restoring records to the Aerospike cluster.
	// By default, the cluster is checked for batch write support.
	DisableBatchWrites *bool
	// The max number of outstanding async record batch write calls at a time.
	MaxAsyncBatches *int
	// The max allowed number of records per an async batch write call.
	// Default is 128 with batch writes enabled, or 16 without batch writes.
	BatchSize *int
	// Namespace details for the restore operation.
	// By default, the data is restored to the namespace from which it was taken.
	Namespace *RestoreNamespace
	// The sets to restore (optional, an empty list implies restoring all sets).
	SetList []string
	// The bins to restore (optional, an empty list implies restoring all bins).
	BinList []string
	// Replace records. This controls how records from the backup overwrite existing records in
	// the namespace. By default, restoring a record from a backup only replaces the bins
	// contained in the backup; all other bins of an existing record remain untouched.
	Replace *bool
	// Existing records take precedence. With this option, only records that do not exist in
	// the namespace are restored, regardless of generation numbers. If a record exists in
	// the namespace, the record from the backup is ignored.
	Unique *bool
	// Records from backups take precedence. This option disables the generation check.
	// With this option, records from the backup always overwrite records that already exist in
	// the namespace, regardless of generation numbers.
	NoGeneration *bool
	// Throttles read operations from the backup file(s) to not exceed the given I/O bandwidth in MiB/s.
	Bandwidth *int64
	// Throttles read operations from the backup file(s) to not exceed the given number of transactions
	// per second.
	Tps *int
	// Encryption details.
	EncryptionPolicy *EncryptionPolicy
	// Compression details.
	CompressionPolicy *CompressionPolicy
	// Configuration of retries for each restore write operation.
	RetryPolicy *models.RetryPolicy
	// Amount of extra time-to-live to add to records that have expirable void-times.
	// Must be set in seconds.
	ExtraTTL *int64
}

RestorePolicy represents a policy for the restore operation.

func (*RestorePolicy) GetBatchSizeOrDefault

func (p *RestorePolicy) GetBatchSizeOrDefault() int

func (*RestorePolicy) GetMaxAsyncBatchesOrDefault

func (p *RestorePolicy) GetMaxAsyncBatchesOrDefault() int

func (*RestorePolicy) GetParallelOrDefault

func (p *RestorePolicy) GetParallelOrDefault() int

func (*RestorePolicy) GetRetryPolicyOrDefault

func (p *RestorePolicy) GetRetryPolicyOrDefault() *models.RetryPolicy

type RestoreRequest

type RestoreRequest struct {
	DestinationCluster *AerospikeCluster
	Policy             *RestorePolicy
	SourceStorage      Storage
	SecretAgent        *SecretAgent
	BackupDataPath     string // path to the backup data
}

RestoreRequest represents a restore operation request.

func NewRestoreRequest

func NewRestoreRequest(
	destinationCluster *AerospikeCluster,
	policy *RestorePolicy,
	sourceStorage Storage,
	secretAgent *SecretAgent,
	backupDataPath string,
) *RestoreRequest

NewRestoreRequest creates a new RestoreRequest.

func (RestoreRequest) String

func (r RestoreRequest) String() string

String satisfies the fmt.Stringer interface.

type RestoreTimestampRequest

type RestoreTimestampRequest struct {
	// The details of the Aerospike destination cluster.
	DestinationCluster *AerospikeCluster
	// Restore policy to use in the operation.
	Policy *RestorePolicy
	// Secret Agent configuration (optional).
	SecretAgent *SecretAgent
	// Required epoch time for recovery. The closest backup before the timestamp will be applied.
	Time time.Time
	// The backup routine name.
	RoutineName string
	// Disable reverse order of incremental backups optimization.
	DisableReordering bool
}

RestoreTimestampRequest represents a restore by timestamp operation request.

func (RestoreTimestampRequest) String

func (r RestoreTimestampRequest) String() string

String satisfies the fmt.Stringer interface.

type RetentionPolicy

type RetentionPolicy struct {
	FullBackups *int // Number of full backups to store
	IncrBackups *int // Number of full backups to store incremental backups for
}

func (*RetentionPolicy) GetIncrementalRetentionCount added in v3.3.1

func (r *RetentionPolicy) GetIncrementalRetentionCount() *int

GetIncrementalRetentionCount returns the effective number of full backups for which to retain incremental backups. When IncrBackups is nil (meaning "retain all incrementals"), this returns the FullBackups value since incremental backups cannot exist without their corresponding full backup.

type RoutineState added in v3.1.0

type RoutineState struct {
	// Full represents the state of a full backup. Nil if no full backup is running.
	Full *RunningJob
	// Incremental represents the state of an incremental backup. Nil if no incremental backup is running.
	Incremental *RunningJob
	// LastRunTime contains information about the latest run time for both full and incremental backups.
	LastRunTime *BackupTime
	// NextRunTime specifies the scheduled next execution time for the routine's backup operations.
	NextRunTime *BackupTime
}

RoutineState represent the current state of backups (full and incremental).

type RunningJob

type RunningJob struct {
	// TotalRecords: the total number of records to be processed.
	// For backup jobs, this value is only an estimate, not exact.
	TotalRecords uint64
	// DoneRecords: the number of records that have been successfully done.
	DoneRecords uint64
	// StartTime: the time when the operation started.
	StartTime time.Time
	// FinishTime: the time when the operation finished.
	// nil value indicates that operation is still running.
	FinishTime *time.Time
	// PercentageDone is the current progress of the operation as a percentage.
	// For backup jobs, this value can exceed 100% if:
	//   * new data is written to the database during the backup, or
	//   * the estimated total record count is lower than the actual count.
	PercentageDone uint
	// EstimatedEndTime: the estimated time when the operation will be completed.
	// A nil value indicates that the estimation is not available yet.
	// This value is not guaranteed to be accurate and may even be earlier than
	// the current time if PercentageDone exceeds 100%.
	EstimatedEndTime *time.Time
	// Metrics contains performance metrics for the current operation.
	Metrics *models.Metrics
}

RunningJob tracks progress of currently running job.

type S3Authentication

type S3Authentication struct {
	KeyIDSecret     string
	AccessKeySecret string
	SecretAgent     *SecretAgent
}

func (*S3Authentication) ReadSecrets

func (a *S3Authentication) ReadSecrets() (keyID, accessKey string, err error)

type S3Storage

type S3Storage struct {
	// Path is the root directory within the S3 bucket where backups will be stored.
	// It should not include the bucket name.
	Path string
	// Bucket is the name of the S3 bucket where backups will be stored.
	Bucket string
	// S3Region is the AWS region where the S3 bucket is located.
	S3Region string
	// S3Profile is the name of the AWS credentials profile to use.
	S3Profile string
	// S3EndpointOverride is used to specify a custom S3 endpoint.
	S3EndpointOverride *string
	// S3LogLevel controls the verbosity of the AWS SDK logging.
	// Valid values are: OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE.
	S3LogLevel *string
	// MinPartSize is the minimum size in bytes for multipart upload parts.
	MinPartSize *int
	// MaxConnsPerHost limits the number of concurrent connections to S3.
	MaxConnsPerHost *int
	// Optional authentication.
	Auth *S3Authentication
	// StorageClass defines the storage class for data and metadata objects.
	StorageClass *StorageClass
}

func (*S3Storage) GetPath added in v3.1.0

func (s *S3Storage) GetPath() string

func (*S3Storage) GetStorageClass added in v3.1.0

func (s *S3Storage) GetStorageClass() StorageClass

func (*S3Storage) String

func (s *S3Storage) String() string

type SecretAgent

type SecretAgent struct {

	// Connection type: tcp, unix.
	ConnectionType string
	// Address of the Secret Agent.
	Address string
	// Port the Secret Agent is running on.
	Port *Port
	// Timeout in milliseconds.
	Timeout *int
	// The path to a trusted CA certificate file in PEM format.
	TLSCAString *string
	// Flag that shows if secret agent responses are encrypted with base64.
	IsBase64 *bool
	// contains filtered or unexported fields
}

SecretAgent represents the configuration of an Aerospike Secret Agent for a backup/restore operation. Aerospike Secret Agent acts as a proxy layer between Aerospike server and one or more external secrets management services, fetching secrets on behalf of the server.

func (*SecretAgent) Read

func (s *SecretAgent) Read(path string) (string, error)

Read reads the secret at the given path using the Secret Agent. If no secret agent is configured, it returns the original path. If given path is not SA path (not starts with "secrets:"), it returns the original path.

func (*SecretAgent) String

func (s *SecretAgent) String() string

String returns a string representation of the SecretAgent.

func (*SecretAgent) ToSecretAgentConfig

func (s *SecretAgent) ToSecretAgentConfig() *backup.SecretAgentConfig

type SeedNode

type SeedNode struct {
	// The host name of the node.
	HostName string
	// The port of the node.
	Port Port
	// TLS certificate name used for secure connections (if enabled).
	TLSName string
}

SeedNode represents details of a node in the Aerospike cluster.

func (SeedNode) String

func (s SeedNode) String() string

String returns a string representation of the SeedNode.

type StatusFilter added in v3.2.0

type StatusFilter struct {
	// contains filtered or unexported fields
}

StatusFilter defines a filter for JobStatus values.

func NewStatusFilter added in v3.2.0

func NewStatusFilter(statuses []JobStatus, isExclude bool) StatusFilter

func (StatusFilter) Matches added in v3.2.0

func (sf StatusFilter) Matches(status JobStatus) bool

Matches returns true if the given status matches the filter criteria. If no statuses are defined in the filter, all statuses are considered a match. In include mode, it returns true if the status IS in the included set. In exclude mode, it returns true if the status is NOT in the excluded set.

type Storage

type Storage interface {
	GetPath() string
	GetStorageClass() StorageClass
	String() string
}

Storage represents the configuration for a backup storage details. This interface is implemented by all specific storage types.

type StorageClass added in v3.1.0

type StorageClass struct {
	DataClass     string
	MetadataClass string
}

StorageClass defines the storage class of data and metadata.

type TLS

type TLS struct {
	// Path to a trusted CA certificate file.
	CAFile *string
	// Path to a directory of trusted CA certificates.
	CAPath *string
	// The default TLS name used to authenticate each TLS socket connection.
	Name *string
	// TLS protocol selection criteria. This format is the same as Apache's SSL Protocol.
	Protocols *string
	// TLS cipher selection criteria. The format is the same as OpenSSL's Cipher List Format.
	CipherSuite *string
	// Path to the key for mutual authentication (if Aerospike cluster supports it).
	Keyfile *string
	// Password to load protected TLS-keyfile (env:VAR, file:PATH, PASSWORD).
	KeyfilePassword *string
	// Path to the chain file for mutual authentication (if Aerospike Cluster supports it).
	Certfile *string
}

TLS represents the Aerospike cluster TLS configuration options.

func (*TLS) String

func (tls *TLS) String() string

String returns a string representation of the TLS.

type TimeBounds

type TimeBounds struct {
	FromTime *time.Time
	ToTime   *time.Time
}

TimeBounds represents a period of time between two timestamps.

func NewTimeBounds

func NewTimeBounds(fromTime, toTime *time.Time) (TimeBounds, error)

NewTimeBounds creates a new TimeBounds using provided fromTime and toTime values.

func (TimeBounds) Contains

func (tb TimeBounds) Contains(value time.Time) bool

Contains verifies if the given value lies within FromTime (inclusive) and ToTime (exclusive).

func (TimeBounds) String

func (tb TimeBounds) String() string

String implements the Stringer interface.

type XDRConfig added in v3.1.0

type XDRConfig struct {
	// Local address, where source cluster will send data.
	LocalHost string
	// PortRange limits the range of ports that the TCP server for XDR will listen on (optional).
	PortRange *PortRange
	// Rewind is used to ship all existing records of a namespace.
	// When rewinding a namespace, XDR will scan through the index and ship
	// all the records for that namespace, partition by partition.
	// Can be `all` or number of seconds.
	Rewind string
	// Results queue size.
	// Used by TCP server for XDR.
	ResultQueueSize *int
	// Ack messages queue size.
	// Used by TCP server for XDR.
	AckQueueSize *int
	// Max number of allowed simultaneous connection to server.
	// Used by TCP server for XDR.
	MaxConns *int
	// Timeout in milliseconds for TCP read operations.
	// Used by TCP server for XDR.
	ReadTimeout *time.Duration
	// Timeout in milliseconds for TCP writes operations.
	// Used by TCP server for XDR.
	WriteTimeout *time.Duration
	// Timeout for starting TCP server for XDR.
	// If the TCP server for XDR does not receive any data within this timeout period, it will shut down.
	// This situation can occur if the LocalAddress and LocalPort options are misconfigured.
	StartTimeout *time.Duration
	// How often a backup client will send info commands to check aerospike cluster stats.
	// To measure recovery state and lag.
	PollingPeriod *time.Duration
	// Retry policy for info commands.
	InfoRetryPolicy *models.RetryPolicy
}

func (*XDRConfig) GetAckQueueSizeOrDefault added in v3.1.0

func (c *XDRConfig) GetAckQueueSizeOrDefault() int

GetAckQueueSizeOrDefault returns AckQueueSize value or default.

func (*XDRConfig) GetInfoRetryPolicyOrDefault added in v3.1.0

func (c *XDRConfig) GetInfoRetryPolicyOrDefault() *models.RetryPolicy

GetInfoRetryPolicyOrDefault returns InfoRetryPolicy value or default.

func (*XDRConfig) GetMaxConnsOrDefault added in v3.1.0

func (c *XDRConfig) GetMaxConnsOrDefault() int

GetMaxConnsOrDefault returns MaxConns value or default.

func (*XDRConfig) GetPollingPeriodOrDefault added in v3.1.0

func (c *XDRConfig) GetPollingPeriodOrDefault() time.Duration

GetPollingPeriodOrDefault returns PollingPeriod value or default.

func (*XDRConfig) GetReadTimeoutOrDefault added in v3.1.0

func (c *XDRConfig) GetReadTimeoutOrDefault() time.Duration

GetReadTimeoutOrDefault returns ReadTimeout value or default.

func (*XDRConfig) GetResultQueueSizeOrDefault added in v3.1.0

func (c *XDRConfig) GetResultQueueSizeOrDefault() int

GetResultQueueSizeOrDefault returns ResultQueueSize value or default.

func (*XDRConfig) GetStartTimeoutOrDefault added in v3.1.0

func (c *XDRConfig) GetStartTimeoutOrDefault() time.Duration

GetStartTimeoutOrDefault returns StartTimeout value or default.

func (*XDRConfig) GetWriteTimeoutOrDefault added in v3.1.0

func (c *XDRConfig) GetWriteTimeoutOrDefault() time.Duration

GetWriteTimeoutOrDefault returns WriteTimeout value or default.

Jump to

Keyboard shortcuts

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