model

package
v0.0.0-...-dc2b481 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 20 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CompressNone = "NONE"
	CompressZSTD = "ZSTD"
)

Compression modes

View Source
const (
	StateFileName                = "state.yaml"
	IncrementalBackupDirectory   = "incremental"
	FullBackupDirectory          = "backup"
	ConfigurationBackupDirectory = "configuration"
	DataDirectory                = "data"
)
View Source
const (
	EncryptNone   = "NONE"
	EncryptAES128 = "AES128"
	EncryptAES256 = "AES256"
)

Encryption modes

Variables

This section is empty.

Functions

This section is empty.

Types

type AerospikeCluster

type AerospikeCluster struct {

	// The cluster name.
	ClusterLabel *string `yaml:"label,omitempty" json:"label,omitempty" example:"testCluster"`
	// The seed nodes details.
	SeedNodes []SeedNode `yaml:"seed-nodes,omitempty" json:"seed-nodes,omitempty"`
	// The connection timeout in milliseconds.
	ConnTimeout *int32 `yaml:"conn-timeout,omitempty" json:"conn-timeout,omitempty" example:"5000"`
	// Whether should use "services-alternate" instead of "services" in info request during cluster tending.
	UseServicesAlternate *bool `yaml:"use-services-alternate,omitempty" json:"use-services-alternate,omitempty"`
	// The authentication details to the Aerospike cluster.
	Credentials *Credentials `yaml:"credentials,omitempty" json:"credentials,omitempty"`
	// The cluster TLS configuration.
	TLS *TLS `yaml:"tls,omitempty" json:"tls,omitempty"`
	// Specifies the maximum number of parallel scans per the cluster.
	MaxParallelScans *int `yaml:"max-parallel-scans,omitempty" json:"max-parallel-scans,omitempty" example:"100" validate:"optional"`
	// contains filtered or unexported fields
}

AerospikeCluster represents the configuration for an Aerospike cluster for backup. @Description AerospikeCluster represents the configuration for an Aerospike cluster for backup.

func NewLocalAerospikeCluster

func NewLocalAerospikeCluster() *AerospikeCluster

NewLocalAerospikeCluster returns a new AerospikeCluster to be used in tests.

func (*AerospikeCluster) ASClientHosts

func (c *AerospikeCluster) ASClientHosts() []*as.Host

ASClientHosts builds and returns a Host list from the AerospikeCluster configuration.

func (*AerospikeCluster) ASClientPolicy

func (c *AerospikeCluster) ASClientPolicy() *as.ClientPolicy

ASClientPolicy builds and returns a new ClientPolicy from the AerospikeCluster configuration.

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 PasswordPath, if it exists. Returns the password value. If it failed to read 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) SeedNodesAsString

func (c *AerospikeCluster) SeedNodesAsString() *string

SeedNodesAsString returns string representation of the seed nodes list.

func (*AerospikeCluster) Validate

func (c *AerospikeCluster) Validate() error

Validate validates the Aerospike cluster entity.

type BackupDetails

type BackupDetails struct {
	BackupMetadata
	// The path to the backup files.
	Key *string `yaml:"key,omitempty" json:"key,omitempty" example:"storage/daily/backup/1707915600000/source-ns1"`
}

BackupDetails contains information about a backup. @Description BackupDetails contains information about a backup.

func (BackupDetails) String

func (details BackupDetails) String() string

String satisfies the fmt.Stringer interface.

type BackupMetadata

type BackupMetadata struct {
	// The backup time in the ISO 8601 format.
	Created time.Time `yaml:"created,omitempty" json:"created,omitempty" example:"2023-03-20T14:50:00Z"`
	// The lower time bound of backup entities in the ISO 8601 format (for incremental backups).
	From time.Time `yaml:"from,omitempty" json:"from,omitempty" example:"2023-03-19T14:50:00Z"`
	// The namespace of a backup.
	Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty" example:"testNamespace"`
	// The total number of records backed up.
	RecordCount uint64 `yaml:"record-count,omitempty" json:"record-count,omitempty" format:"int64" example:"100"`
	// The size of the backup in bytes.
	ByteCount uint64 `yaml:"byte-count,omitempty" json:"byte-count,omitempty" format:"int64" example:"2000"`
	// The number of backup files created.
	FileCount uint64 `yaml:"file-count,omitempty" json:"file-count,omitempty" format:"int64" example:"1"`
	// The number of secondary indexes backed up.
	SecondaryIndexCount uint64 `yaml:"secondary-index-count,omitempty" json:"secondary-index-count,omitempty" format:"int64" example:"5"`
	// The number of UDF files backed up.
	UDFCount uint64 `yaml:"udf-count,omitempty" json:"udf-count,omitempty" format:"int64" example:"2"`
}

BackupMetadata is an internal container for storing backup metadata.

type BackupPolicy

type BackupPolicy struct {
	// Maximum number of scan calls to run in parallel.
	Parallel *int32 `yaml:"parallel,omitempty" json:"parallel,omitempty" example:"1"`
	// Socket timeout in milliseconds. If this value is 0, it is set to total-timeout.
	// If both are 0, there is no socket idle time limit.
	SocketTimeout *int32 `yaml:"socket-timeout,omitempty" json:"socket-timeout,omitempty" example:"1000"`
	// Total socket timeout in milliseconds. Default is 0, that is, no timeout.
	TotalTimeout *int32 `yaml:"total-timeout,omitempty" json:"total-timeout,omitempty" example:"2000"`
	// Maximum number of retries before aborting the current transaction.
	MaxRetries *int32 `yaml:"max-retries,omitempty" json:"max-retries,omitempty" example:"3"`
	// RetryDelay defines the delay in milliseconds before retrying a failed operation.
	RetryDelay *int32 `yaml:"retry-delay,omitempty" json:"retry-delay,omitempty" example:"500"`
	// Whether to clear the output directory (default: KeepAll).
	RemoveFiles *RemoveFilesType `yaml:"remove-files,omitempty" json:"remove-files,omitempty" enums:"KeepAll,RemoveAll,RemoveIncremental"`
	// Do not back up any record data (metadata or bin data).
	NoRecords *bool `yaml:"no-records,omitempty" json:"no-records,omitempty"`
	// Do not back up any secondary index definitions.
	NoIndexes *bool `yaml:"no-indexes,omitempty" json:"no-indexes,omitempty"`
	// Do not back up any UDF modules.
	NoUdfs *bool `yaml:"no-udfs,omitempty" json:"no-udfs,omitempty"`
	// Throttles backup write operations to the backup file(s) to not exceed the given
	// bandwidth in MiB/s.
	Bandwidth *int64 `yaml:"bandwidth,omitempty" json:"bandwidth,omitempty" example:"10000"`
	// Limit total returned records per second (RPS). If RPS is zero (the default),
	// the records-per-second limit is not applied.
	RecordsPerSecond *int32 `yaml:"records-per-second,omitempty" json:"records-per-second,omitempty" example:"1000"`
	// File size limit (in MB) for the backup directory. If an .asb backup file crosses this size threshold,
	// a new backup file will be created.
	FileLimit *int64 `yaml:"file-limit,omitempty" json:"file-limit,omitempty" example:"1024"`
	// Encryption details.
	EncryptionPolicy *EncryptionPolicy `yaml:"encryption,omitempty" json:"encryption,omitempty"`
	// Compression details.
	CompressionPolicy *CompressionPolicy `yaml:"compression,omitempty" json:"compression,omitempty"`
	// 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 `yaml:"sealed,omitempty" json:"sealed,omitempty"`
}

BackupPolicy represents a scheduled backup policy. @Description BackupPolicy represents a scheduled backup policy.

func (*BackupPolicy) CopySMDDisabled

func (p *BackupPolicy) CopySMDDisabled() *BackupPolicy

CopySMDDisabled creates a new instance of the BackupPolicy struct with identical field values. New instance has NoIndexes and NoUdfs set to true.

func (*BackupPolicy) GetMaxRetriesOrDefault

func (p *BackupPolicy) GetMaxRetriesOrDefault() int32

GetMaxRetriesOrDefault returns the value of the MaxRetries property. If the property is not set, it returns the default value.

func (*BackupPolicy) GetRetryDelayOrDefault

func (p *BackupPolicy) GetRetryDelayOrDefault() int32

GetRetryDelayOrDefault returns the value of the RetryDelay property. If the property is not set, it returns the default value.

func (*BackupPolicy) IsSealed

func (p *BackupPolicy) IsSealed() bool

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

func (*BackupPolicy) Validate

func (p *BackupPolicy) Validate() error

Validate checks if the BackupPolicy is valid and has feasible parameters for the backup to commence.

type BackupRoutine

type BackupRoutine struct {
	// The name of the corresponding backup policy.
	BackupPolicy string `yaml:"backup-policy,omitempty" json:"backup-policy,omitempty" example:"daily" validate:"required"`
	// The name of the corresponding source cluster.
	SourceCluster string `yaml:"source-cluster,omitempty" json:"source-cluster,omitempty" example:"testCluster" validate:"required"`
	// The name of the corresponding storage provider configuration.
	Storage string `yaml:"storage,omitempty" json:"storage,omitempty" example:"aws" validate:"required"`
	// The Secret Agent configuration for the routine (optional).
	SecretAgent *string `yaml:"secret-agent,omitempty" json:"secret-agent,omitempty" example:"sa"`
	// The interval for full backup as a cron expression string.
	IntervalCron string `yaml:"interval-cron" json:"interval-cron" example:"0 0 * * * *" validate:"required"`
	// The interval for incremental backup as a cron expression string (optional).
	IncrIntervalCron string `yaml:"incr-interval-cron" json:"incr-interval-cron" example:"*/10 * * * * *"`
	// The list of the namespaces to back up (optional, empty list implies backup up whole cluster).
	Namespaces []string `yaml:"namespaces,omitempty" json:"namespaces,omitempty" example:"source-ns1"`
	// The list of backup set names (optional, an empty list implies backing up all sets).
	SetList []string `yaml:"set-list,omitempty" json:"set-list,omitempty" example:"set1"`
	// The list of backup bin names (optional, an empty list implies backing up all bins).
	BinList []string `yaml:"bin-list,omitempty" json:"bin-list,omitempty" example:"dataBin"`
	// A list of Aerospike Server rack IDs to prefer when reading records for a backup.
	PreferRacks []int `yaml:"prefer-racks,omitempty" json:"prefer-racks,omitempty" example:"0"`
	// Back up list of partition filters. Partition filters can be ranges, individual partitions,
	// or records after a specific digest within a single partition.
	// Default number of partitions to back up: 0 to 4095: all partitions.
	PartitionList *string `yaml:"partition-list,omitempty" json:"partition-list,omitempty" example:"0-1000"`
}

BackupRoutine represents a scheduled backup operation routine. @Description BackupRoutine represents a scheduled backup operation routine.

func (*BackupRoutine) Validate

func (r *BackupRoutine) Validate(c *Config) error

Validate validates the backup routine configuration.

type BackupServiceConfig

type BackupServiceConfig struct {
	// HTTPServer is the backup service HTTP server configuration.
	HTTPServer *HTTPServerConfig `yaml:"http,omitempty" json:"http,omitempty"`
	// Logger is the backup service logger configuration.
	Logger *LoggerConfig `yaml:"logger,omitempty" json:"logger,omitempty"`
}

BackupServiceConfig represents the backup service configuration properties. @Description BackupServiceConfig represents the backup service configuration properties.

func NewBackupServiceConfigWithDefaultValues

func NewBackupServiceConfigWithDefaultValues() *BackupServiceConfig

NewBackupServiceConfigWithDefaultValues returns a new BackupServiceConfig with default values.

type BackupState

type BackupState struct {
	sync.Mutex
	// Last time the full backup was performed.
	LastFullRun time.Time `yaml:"last-run,omitempty" json:"last-run,omitempty" example:"2023-12-14T10:08:54Z"`
	// Last time the incremental backup was performed.
	LastIncrRun time.Time `yaml:"last-incr-run,omitempty" json:"last-incr-run,omitempty" example:"2023-12-15T12:00:00Z"`
	// The number of successful full backups created for the routine.
	Performed int `yaml:"performed,omitempty" json:"performed,omitempty" example:"5"`
}

BackupState represents the state of a backup routine. @Description BackupState represents the state of a backup routine.

func NewBackupState

func NewBackupState() *BackupState

NewBackupState returns a BackupState with the default values.

func (*BackupState) LastFullRunIsEmpty

func (state *BackupState) LastFullRunIsEmpty() bool

func (*BackupState) LastRun

func (state *BackupState) LastRun() time.Time

func (*BackupState) SetLastFullRun

func (state *BackupState) SetLastFullRun(time time.Time)

func (*BackupState) SetLastIncrRun

func (state *BackupState) SetLastIncrRun(time time.Time)

func (*BackupState) String

func (state *BackupState) String() string

String satisfies the fmt.Stringer interface.

type CompressionPolicy

type CompressionPolicy struct {
	// The compression mode to be used (default is NONE).
	Mode string `yaml:"mode,omitempty" json:"mode,omitempty" default:"NONE" enums:"NONE,ZSTD"`
	// The compression level to use (or -1 if unspecified).
	Level int32 `yaml:"level,omitempty" json:"level,omitempty"`
}

CompressionPolicy contains backup compression information. @Description CompressionPolicy contains backup compression information.

func (*CompressionPolicy) Validate

func (p *CompressionPolicy) Validate() error

Validate validates the compression policy.

type Config

type Config struct {
	ServiceConfig     *BackupServiceConfig         `yaml:"service,omitempty" json:"service,omitempty"`
	AerospikeClusters map[string]*AerospikeCluster `yaml:"aerospike-clusters,omitempty" json:"aerospike-clusters,omitempty"`
	Storage           map[string]*Storage          `yaml:"storage,omitempty" json:"storage,omitempty"`
	BackupPolicies    map[string]*BackupPolicy     `yaml:"backup-policies,omitempty" json:"backup-policies,omitempty"`
	BackupRoutines    map[string]*BackupRoutine    `yaml:"backup-routines,omitempty" json:"backup-routines,omitempty"`
	SecretAgents      map[string]*SecretAgent      `yaml:"secret-agent,omitempty" json:"secret-agent,omitempty"`
}

Config represents the service configuration file. @Description Config represents the service configuration file.

func NewConfigWithDefaultValues

func NewConfigWithDefaultValues() *Config

NewConfigWithDefaultValues returns a new Config with default values.

func (Config) String

func (c Config) String() string

String satisfies the fmt.Stringer interface.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

type Credentials

type Credentials struct {
	// The username for the cluster authentication.
	User *string `yaml:"user,omitempty" json:"user,omitempty" example:"testUser"`
	// The password for the cluster authentication.
	Password *string `yaml:"password,omitempty" json:"password,omitempty" example:"testPswd"`
	// The file path with the password string, will take precedence over the password field.
	PasswordPath *string `yaml:"password-path,omitempty" json:"password-path,omitempty" example:"/path/to/pass.txt"`
	// The authentication mode string (INTERNAL, EXTERNAL, EXTERNAL_INSECURE, PKI).
	AuthMode *string `yaml:"auth-mode,omitempty" json:"auth-mode,omitempty" enums:"INTERNAL,EXTERNAL,EXTERNAL_INSECURE,PKI"`
}

Credentials represents authentication details to the Aerospike cluster. @Description Credentials represents authentication details to the Aerospike cluster.

type CurrentBackups

type CurrentBackups struct {
	// Full represents the state of a full backup. Nil if no full backup is running.
	Full *RunningJob `json:"full,omitempty"`
	// Incremental represents the state of an incremental backup. Nil if no incremental backup is running.
	Incremental *RunningJob `json:"incremental,omitempty"`
}

CurrentBackups represent the current state of backups (full and incremental)

type EncryptionPolicy

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

EncryptionPolicy contains backup encryption information. @Description EncryptionPolicy contains backup encryption information.

func (*EncryptionPolicy) Validate

func (p *EncryptionPolicy) Validate() error

Validate validates the encryption policy.

type FileLoggerConfig

type FileLoggerConfig struct {
	// Filename is the file to write logs to.
	Filename string `yaml:"filename" json:"filename" example:"log.txt"`
	// MaxSize is the maximum size in megabytes of the log file before it gets rotated.
	MaxSize int `yaml:"maxsize" json:"maxsize" default:"100" example:"100"`
	// 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 `yaml:"maxage" json:"maxage" default:"0"`
	// MaxBackups is the maximum number of old log files to retain. The default
	// is to retain all old log files.
	MaxBackups int `yaml:"maxbackups" json:"maxbackups" default:"0"`
	// Compress determines if the rotated log files should be compressed
	// using gzip. The default is not to perform compression.
	Compress bool `yaml:"compress" json:"compress" default:"false"`
}

FileLoggerConfig represents the configuration for the file logger writer. @Description FileLoggerConfig represents the configuration for the file logger writer.

func (*FileLoggerConfig) Validate

func (f *FileLoggerConfig) Validate() error

Validate validates the file logger configuration.

type HTTPServerConfig

type HTTPServerConfig struct {
	// The address to listen on.
	Address *string `yaml:"address,omitempty" json:"address,omitempty" default:"0.0.0.0" example:"0.0.0.0"`
	// The port to listen on.
	Port *int `yaml:"port,omitempty" json:"port,omitempty" default:"8080" example:"8080"`
	// HTTP rate limiter configuration.
	Rate *RateLimiterConfig `yaml:"rate,omitempty" json:"rate,omitempty"`
	// ContextPath customizes path for the API endpoints.
	ContextPath *string `yaml:"context-path,omitempty" json:"context-path,omitempty" default:"/"`
	// Timeout for http server operations in milliseconds.
	Timeout *int `yaml:"timeout,omitempty" json:"timeout,omitempty" default:"5000"`
}

HTTPServerConfig represents the service's HTTP server configuration. @Description 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() int

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) GetTimeout

func (s *HTTPServerConfig) GetTimeout() int

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

func (*HTTPServerConfig) Validate

func (s *HTTPServerConfig) Validate() error

Validate validates the HTTP server configuration.

type JobStatus

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

type LoggerConfig

type LoggerConfig struct {
	// Level is the logger level.
	Level *string `yaml:"level,omitempty" json:"level,omitempty" default:"DEBUG" enums:"TRACE,DEBUG,INFO,WARN,WARNING,ERROR"`
	// Format is the logger format (PLAIN, JSON).
	Format *string `yaml:"format,omitempty" json:"format,omitempty" default:"PLAIN" enums:"PLAIN,JSON"`
	// Whether to enable logging to the standard output.
	StdoutWriter *bool `yaml:"stdout-writer,omitempty" json:"stdout-writer,omitempty" default:"true"`
	// File writer logging configuration.
	FileWriter *FileLoggerConfig `yaml:"file-writer,omitempty" json:"file-writer,omitempty" default:""`
}

LoggerConfig represents the backup service logger configuration. @Description 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.

func (*LoggerConfig) Validate

func (l *LoggerConfig) Validate() error

Validate validates the logger configuration.

type Node

type Node struct {
	IP   string `yaml:"ip" json:"ip" example:"192.168.0.2"`
	Port int    `yaml:"port" json:"port" example:"3000"`
}

Node represents the Aerospike node details. @Description Node represents the Aerospike node details.

type RateLimiterConfig

type RateLimiterConfig struct {
	// Rate limiter tokens per second threshold.
	Tps *int `yaml:"tps,omitempty" json:"tps,omitempty" default:"1024" example:"1024"`
	// Rate limiter token bucket size (bursts threshold).
	Size *int `yaml:"size,omitempty" json:"size,omitempty" default:"1024" example:"1024"`
	// The list of ips to whitelist in rate limiting.
	WhiteList []string `yaml:"white-list,omitempty" json:"white-list,omitempty" default:""`
}

RateLimiterConfig represents the service's HTTP server rate limiter configuration. @Description RateLimiterConfig is the 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 RemoveFilesType

type RemoveFilesType string

RemoveFilesType represents the type of the backup storage. @Description RemoveFilesType represents the type of the backup storage.

const (
	KeepAll           RemoveFilesType = "KeepAll"
	RemoveAll         RemoveFilesType = "RemoveAll"
	RemoveIncremental RemoveFilesType = "RemoveIncremental"
)

func (*RemoveFilesType) RemoveFullBackup

func (r *RemoveFilesType) RemoveFullBackup() bool

func (*RemoveFilesType) RemoveIncrementalBackup

func (r *RemoveFilesType) RemoveIncrementalBackup() bool

type RestoreJobID

type RestoreJobID int

RestoreJobID represents the restore operation job id.

type RestoreJobStatus

type RestoreJobStatus struct {
	RestoreStats
	CurrentRestore *RunningJob `yaml:"current-restore,omitempty" json:"current-job,omitempty"`
	Status         JobStatus   `yaml:"status,omitempty" json:"status,omitempty" enums:"Running,Done,Failed"`
	Error          string      `yaml:"error,omitempty" json:"error,omitempty"`
}

RestoreJobStatus represents a restore job status. @Description RestoreJobStatus represents a restore job status.

type RestoreNamespace

type RestoreNamespace struct {
	// Original namespace name.
	Source *string `json:"source,omitempty" example:"source-ns" validate:"required"`
	// Destination namespace name.
	Destination *string `json:"destination,omitempty" example:"destination-ns" validate:"required"`
}

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.

@Description RestoreNamespace specifies an alternative namespace name for the restore @Description operation.

func (*RestoreNamespace) Validate

func (n *RestoreNamespace) Validate() error

Validate validates the restore namespace.

type RestorePolicy

type RestorePolicy struct {
	// The number of concurrent record readers from backup files.
	Parallel *int32 `json:"parallel,omitempty" example:"8"`
	// 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 `json:"no-records,omitempty"`
	// Do not restore any secondary index definitions.
	NoIndexes *bool `json:"no-indexes,omitempty"`
	// Do not restore any UDF modules.
	NoUdfs *bool `json:"no-udfs,omitempty"`
	// Timeout (ms) for Aerospike commands to write records, create indexes and create UDFs.
	Timeout *int32 `json:"timeout,omitempty" example:"1000"`
	// 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 `json:"disable-batch-writes,omitempty"`
	// The max number of outstanding async record batch write calls at a time.
	MaxAsyncBatches *int32 `json:"max-async-batches,omitempty" example:"32"`
	// 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 *int32 `json:"batch-size,omitempty" example:"128"`
	// Namespace details for the restore operation.
	// By default, the data is restored to the namespace from which it was taken.
	Namespace *RestoreNamespace `json:"namespace,omitempty"`
	// The sets to restore (optional, an empty list implies restoring all sets).
	SetList []string `json:"set-list,omitempty" example:"set1,set2"`
	// The bins to restore (optional, an empty list implies restoring all bins).
	BinList []string `json:"bin-list,omitempty" example:"bin1,bin2"`
	// 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 `json:"replace,omitempty"`
	// 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 `json:"unique,omitempty"`
	// 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 `json:"no-generation,omitempty"`
	// Throttles read operations from the backup file(s) to not exceed the given I/O bandwidth in bytes/sec.
	Bandwidth *int64 `json:"bandwidth,omitempty" example:"50000"`
	// Throttles read operations from the backup file(s) to not exceed the given number of transactions
	// per second.
	Tps *int32 `json:"tps,omitempty" example:"4000"`
	// Encryption details.
	EncryptionPolicy *EncryptionPolicy `yaml:"encryption,omitempty" json:"encryption,omitempty"`
	// Compression details.
	CompressionPolicy *CompressionPolicy `yaml:"compression,omitempty" json:"compression,omitempty"`
	// Configuration of retries for each restore write operation.
	// If nil, no retries will be performed.
	RetryPolicy *RetryPolicy `yaml:"retry-policy,omitempty" json:"retry-policy,omitempty"`
}

RestorePolicy represents a policy for the restore operation. @Description RestorePolicy represents a policy for the restore operation.

func (*RestorePolicy) GetRetryPolicyOrDefault

func (p *RestorePolicy) GetRetryPolicyOrDefault() *RetryPolicy

func (*RestorePolicy) Validate

func (p *RestorePolicy) Validate() error

Validate validates the restore policy.

type RestoreRequest

type RestoreRequest struct {
	DestinationCuster *AerospikeCluster `json:"destination,omitempty" validate:"required"`
	Policy            *RestorePolicy    `json:"policy,omitempty" validate:"required"`
	SourceStorage     *Storage          `json:"source,omitempty" validate:"required"`
	SecretAgent       *SecretAgent      `json:"secret-agent,omitempty"`
}

RestoreRequest represents a restore operation request. @Description RestoreRequest represents a restore operation request.

func NewRestoreRequest

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

NewRestoreRequest creates a new RestoreRequest.

func (RestoreRequest) String

func (r RestoreRequest) String() string

String satisfies the fmt.Stringer interface.

func (*RestoreRequest) Validate

func (r *RestoreRequest) Validate() error

Validate validates the restore operation request.

type RestoreRequestInternal

type RestoreRequestInternal struct {
	RestoreRequest
	Dir *string
}

RestoreRequestInternal is used internally to prepopulate data for the restore operation.

type RestoreStats

type RestoreStats struct {
	ReadRecords     uint64 `yaml:"read-records,omitempty" json:"read-records,omitempty" format:"int64" example:"10"`
	TotalBytes      uint64 `yaml:"total-bytes,omitempty" json:"total-bytes,omitempty" format:"int64" example:"2000"`
	ExpiredRecords  uint64 `yaml:"expired-records,omitempty" json:"expired-records,omitempty" format:"int64" example:"2"`
	SkippedRecords  uint64 `yaml:"skipped-records,omitempty" json:"skipped-records,omitempty" format:"int64" example:"4"`
	IgnoredRecords  uint64 `yaml:"ignored-records,omitempty" json:"ignored-records,omitempty" format:"int64" example:"12"`
	InsertedRecords uint64 `yaml:"inserted-records,omitempty" json:"inserted-records,omitempty" format:"int64" example:"8"`
	ExistedRecords  uint64 `yaml:"existed-records,omitempty" json:"existed-records,omitempty" format:"int64" example:"15"`
	FresherRecords  uint64 `yaml:"fresher-records,omitempty" json:"fresher-records,omitempty" format:"int64" example:"5"`
	IndexCount      uint64 `yaml:"index-count,omitempty" json:"index-count,omitempty" format:"int64" example:"3"`
	UDFCount        uint64 `yaml:"udf-count,omitempty" json:"udf-count,omitempty" format:"int64" example:"1"`
}

RestoreStats represents the statistics of a restore operation.

type RestoreTimestampRequest

type RestoreTimestampRequest struct {
	// The details of the Aerospike destination cluster.
	DestinationCuster *AerospikeCluster `json:"destination,omitempty" validate:"required"`
	// Restore policy to use in the operation.
	Policy *RestorePolicy `json:"policy,omitempty" validate:"required"`
	// Secret Agent configuration (optional).
	SecretAgent *SecretAgent `json:"secret-agent,omitempty"`
	// Required epoch time for recovery. The closest backup before the timestamp will be applied.
	Time int64 `json:"time,omitempty" format:"int64" example:"1739538000000" validate:"required"`
	// The backup routine name.
	Routine string `json:"routine,omitempty" example:"daily" validate:"required"`
}

RestoreTimestampRequest represents a restore by timestamp operation request. @Description RestoreTimestampRequest represents a restore by timestamp operation request.

func (RestoreTimestampRequest) String

func (r RestoreTimestampRequest) String() string

String satisfies the fmt.Stringer interface.

func (*RestoreTimestampRequest) Validate

func (r *RestoreTimestampRequest) Validate() error

Validate validates the restore operation request.

type RetryPolicy

type RetryPolicy struct {
	// BaseTimeout is the initial delay between retry attempts, in milliseconds.
	BaseTimeout int64 `json:"baseTimeout" yaml:"baseTimeout"`

	// Multiplier is used to increase the delay between subsequent retry attempts.
	// The actual delay is calculated as: BaseTimeout * (Multiplier ^ attemptNumber)
	Multiplier float64 `json:"multiplier" yaml:"multiplier"`

	// MaxRetries is the maximum number of retry attempts that will be made.
	// If set to 0, no retries will be performed.
	MaxRetries int `json:"maxRetries" yaml:"maxRetries"`
}

RetryPolicy defines the configuration for retry attempts in case of failures. @Description RetryPolicy defines the configuration for retry attempts in case of failures.

func (*RetryPolicy) GetBaseTimeout

func (rp *RetryPolicy) GetBaseTimeout() time.Duration

GetBaseTimeout converts the BaseTimeout from milliseconds to a time.Duration.

func (*RetryPolicy) Validate

func (rp *RetryPolicy) Validate() error

Validate checks if the RetryPolicy fields are valid.

type RunningJob

type RunningJob struct {
	// TotalRecords: the total number of records to be processed.
	TotalRecords uint64 `json:"total-records,omitempty" example:"100"`
	// DoneRecords: the number of records that have been successfully done.
	DoneRecords uint64 `json:"done-records,omitempty" example:"50"`
	// StartTime: the time when the backup operation started.
	StartTime time.Time `json:"start-time,omitempty" example:"2006-01-02T15:04:05Z07:00"`
	// PercentageDone: the progress of the backup operation as a percentage.
	PercentageDone uint `json:"percentage-done,omitempty" example:"50"`
	// EstimatedEndTime: the estimated time when the backup operation will be completed.
	// A nil value indicates that the estimation is not available yet.
	EstimatedEndTime *time.Time `json:"estimated-end-time,omitempty" example:"2006-01-02T15:04:05Z07:00"`
}

RunningJob tracks progress of currently running job. @Description RunningJob tracks progress of currently running job.

type SecretAgent

type SecretAgent struct {
	// Connection type: tcp, unix.
	ConnectionType *string `yaml:"connection-type,omitempty" json:"connection-type,omitempty" example:"tcp"`
	// Address of the Secret Agent.
	Address *string `yaml:"address,omitempty" json:"address,omitempty" example:"localhost"`
	// Port the Secret Agent is running on.
	Port *int `yaml:"port,omitempty" json:"port,omitempty" example:"8080"`
	// Timeout in milliseconds.
	Timeout *int `yaml:"timeout,omitempty" json:"timeout,omitempty" example:"5000"`
	// The path to a trusted CA certificate file in PEM format.
	TLSCAString *string `yaml:"tls-ca-file,omitempty" json:"tls-ca-file,omitempty" example:"/path/to/ca.pem"`
	// Flag that shows if secret agent responses are encrypted with base64.
	IsBase64 *bool `yaml:"is-base64,omitempty" json:"is-base64,omitempty" example:"false"`
}

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.

@Description SecretAgent represents the configuration of an Aerospike Secret Agent @Description for a backup/restore operation.

type SeedNode

type SeedNode struct {
	// The host name of the node.
	HostName string `yaml:"host-name,omitempty" json:"host-name,omitempty" example:"localhost" validate:"required"`
	// The port of the node.
	Port int32 `yaml:"port,omitempty" json:"port,omitempty" example:"3000" validate:"required"`
	// TLS certificate name used for secure connections (if enabled).
	TLSName string `yaml:"tls-name,omitempty" json:"tls-name,omitempty" example:"certName" validate:"optional"`
}

SeedNode represents details of a node in the Aerospike cluster. @Description SeedNode represents details of a node in the Aerospike cluster.

func (*SeedNode) String

func (node *SeedNode) String() string

String returns the string representation of the SeedNode.

func (*SeedNode) Validate

func (node *SeedNode) Validate() error

Validate validates the SeedNode entity.

type Storage

type Storage struct {
	// The type of the storage provider
	Type StorageType `yaml:"type" json:"type" enums:"local,aws-s3" validate:"required"`
	// The root path for the backup repository.
	Path *string `yaml:"path,omitempty" json:"path,omitempty" example:"backups" validate:"required"`
	// The S3 region string (AWS S3 optional).
	S3Region *string `yaml:"s3-region,omitempty" json:"s3-region,omitempty" example:"eu-central-1"`
	// The S3 profile name (AWS S3 optional).
	S3Profile *string `yaml:"s3-profile,omitempty" json:"s3-profile,omitempty" example:"default"`
	// An alternative endpoint for the S3 SDK to communicate (AWS S3 optional).
	S3EndpointOverride *string `yaml:"s3-endpoint-override,omitempty" json:"s3-endpoint-override,omitempty" example:"http://host.docker.internal:9000"`
	// The log level of the AWS S3 SDK (AWS S3 optional).
	S3LogLevel *string `yaml:"s3-log-level,omitempty" json:"s3-log-level,omitempty" default:"FATAL" enum:"OFF,FATAL,ERROR,WARN,INFO,DEBUG,TRACE"`
	// The minimum size in bytes of individual S3 UploadParts
	MinPartSize int `yaml:"min_part_size,omitempty" json:"min_part_size,omitempty" example:"10" default:"5242880"`
	// The maximum number of simultaneous requests from S3.
	MaxConnsPerHost int `yaml:"max_async_connections,omitempty" json:"max_async_connections,omitempty" example:"16"`
}

Storage represents the configuration for a backup storage details. @Description Storage represents the configuration for a backup storage details.

func (*Storage) SetDefaultProfile

func (s *Storage) SetDefaultProfile()

SetDefaultProfile sets the "default" profile if not set.

func (*Storage) Validate

func (s *Storage) Validate() error

Validate validates the storage configuration.

type StorageType

type StorageType string

StorageType represents the type of the backup storage. @Description StorageType represents the type of the backup storage.

const (
	Local              StorageType = "local"
	S3                 StorageType = "aws-s3"
	MinAllowedPartSize             = 5 * 1024 * 1024 // 5 MB in bytes
)

type TLS

type TLS struct {
	// Path to a trusted CA certificate file.
	CAFile *string `yaml:"ca-file,omitempty" json:"ca-file,omitempty" example:"/path/to/cafile.pem"`
	// Path to a directory of trusted CA certificates.
	CAPath *string `yaml:"ca-path,omitempty" json:"ca-path,omitempty" example:"/path/to/ca"`
	// The default TLS name used to authenticate each TLS socket connection.
	Name *string `yaml:"name,omitempty" json:"name,omitempty" example:"tls-name"`
	// TLS protocol selection criteria. This format is the same as Apache's SSL Protocol.
	Protocols *string `yaml:"protocols,omitempty" json:"protocols,omitempty" example:"TLSv1.2"`
	// TLS cipher selection criteria. The format is the same as OpenSSL's Cipher List Format.
	CipherSuite *string `yaml:"cipher-suite,omitempty" json:"cipher-suite,omitempty" example:"ECDHE-ECDSA-AES256-GCM-SHA384"`
	// Path to the key for mutual authentication (if Aerospike cluster supports it).
	Keyfile *string `yaml:"key-file,omitempty" json:"key-file,omitempty" example:"/path/to/keyfile.pem"`
	// Password to load protected TLS-keyfile (env:VAR, file:PATH, PASSWORD).
	KeyfilePassword *string `yaml:"key-file-password,omitempty" json:"key-file-password,omitempty" example:"file:/path/to/password"`
	// Path to the chain file for mutual authentication (if Aerospike Cluster supports it).
	Certfile *string `yaml:"cert-file,omitempty" json:"cert-file,omitempty" example:"/path/to/certfile.pem"`
}

TLS represents the Aerospike cluster TLS configuration options. @Description TLS represents the Aerospike cluster TLS configuration options.

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 NewTimeBoundsFrom

func NewTimeBoundsFrom(fromTime time.Time) *TimeBounds

NewTimeBoundsFrom creates a new TimeBounds from the provided fromTime.

func NewTimeBoundsFromString

func NewTimeBoundsFromString(from, to string) (*TimeBounds, error)

NewTimeBoundsFromString creates a TimeBounds from the string representation of time boundaries (string is given as epoch time millis).

func NewTimeBoundsTo

func NewTimeBoundsTo(toTime time.Time) *TimeBounds

NewTimeBoundsTo creates a new TimeBounds until the provided toTime.

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.

Jump to

Keyboard shortcuts

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