config

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxRack max number of racks that can exist.
	MaxRack = 1000000
	// StdPlaceholder is the placeholder for stdout file name.
	StdPlaceholder = "-"
)

Variables

This section is empty.

Functions

func DumpFile

func DumpFile(filename string, params any) error

DumpFile used for tests.

func NewBackupConfigs

func NewBackupConfigs(serviceConfig *BackupServiceConfig, logger *slog.Logger,
) (*backup.ConfigBackup, *backup.ConfigBackupXDR, error)

NewBackupConfigs creates and returns a new ConfigBackup and ConfigBackupXDR object, initialized with given backup parameters. This function sets various backup parameters including namespace, file limits, parallelism options, bandwidth, compression, encryption, and partition filters. It returns an error if any validation or parsing fails. If the backup is an XDR backup, it will return a ConfigBackupXDR object. Otherwise, it will return a ConfigBackup object.

func NewRestoreConfig

func NewRestoreConfig(config *RestoreServiceConfig, logger *slog.Logger) *backup.ConfigRestore

NewRestoreConfig creates and returns a new ConfigRestore object, initialized with given restore parameters.

Types

type BackupServiceConfig

type BackupServiceConfig struct {
	Backup    *models.Backup
	BackupXDR *models.BackupXDR

	ServiceConfigCommon
}

BackupServiceConfig represents the configuration structure for the backup service involving various policies and integrations.

func DecodeBackupServiceConfig

func DecodeBackupServiceConfig(ctx context.Context, filename string) (*BackupServiceConfig, error)

DecodeBackupServiceConfig reads a backup configuration file and decodes it into BackupServiceConfig. Secret agent references (secrets:resource:key) in the YAML are resolved before conversion. Returns an error on failure.

func NewBackupServiceConfig

func NewBackupServiceConfig(
	app *models.App,
	clientConfig *client.AerospikeConfig,
	clientPolicy *models.ClientPolicy,
	backupScan *models.Backup,
	backupXDR *models.BackupXDR,
	compression *models.Compression,
	encryption *models.Encryption,
	secretAgent *models.SecretAgent,
	awsS3 *models.AwsS3,
	gcpStorage *models.GcpStorage,
	azureBlob *models.AzureBlob,
	local *models.Local,
) (*BackupServiceConfig, error)

NewBackupServiceConfig initializes and returns a BackupServiceConfig struct with the provided configuration components. It optionally loads configuration from a file if specified in the app.ConfigFilePath.

func (*BackupServiceConfig) IsContinue

func (b *BackupServiceConfig) IsContinue() bool

IsContinue determines if the backup configuration is a continue backup by checking if Backup is non-nil and Continue is non-empty.

func (*BackupServiceConfig) IsStdout

func (b *BackupServiceConfig) IsStdout() bool

IsStdout checks if the backup operation should write to stdout by verifying that Backup is non-nil and OutputFile is StdPlaceholder.

func (*BackupServiceConfig) IsStopXDR

func (b *BackupServiceConfig) IsStopXDR() bool

IsStopXDR checks if the backup operation should stop XDR by verifying that BackupXDR is non-nil and StopXDR is true.

func (*BackupServiceConfig) IsUnblockMRT

func (b *BackupServiceConfig) IsUnblockMRT() bool

IsUnblockMRT checks if the backup operation should unblock MRT writes by verifying that BackupXDR is non-nil and UnblockMRT is true.

func (*BackupServiceConfig) IsXDR

func (b *BackupServiceConfig) IsXDR() bool

IsXDR determines if the backup configuration is an XDR backup by checking if BackupXDR is non-nil and Backup is nil.

func (*BackupServiceConfig) SkipWriterInit

func (b *BackupServiceConfig) SkipWriterInit() bool

SkipWriterInit checks if the backup operation should skip writer initialization by verifying that Backup is non-nil and Estimate is false.

func (*BackupServiceConfig) Validate added in v1.1.0

func (b *BackupServiceConfig) Validate() error

Validate validates the backup configuration and returns an error if any validation fails.

type RestoreServiceConfig

type RestoreServiceConfig struct {
	Restore *models.Restore

	ServiceConfigCommon
}

RestoreServiceConfig contains configuration settings for the restore service, including client, restore, and storage details.

func DecodeRestoreServiceConfig

func DecodeRestoreServiceConfig(ctx context.Context, filename string) (*RestoreServiceConfig, error)

DecodeRestoreServiceConfig reads a restore configuration file and decodes it into RestoreServiceConfig. Secret agent references (secrets:resource:key) in the YAML are resolved before conversion. Returns an error on failure.

func NewRestoreServiceConfig

func NewRestoreServiceConfig(
	app *models.App,
	clientConfig *client.AerospikeConfig,
	clientPolicy *models.ClientPolicy,
	restore *models.Restore,
	compression *models.Compression,
	encryption *models.Encryption,
	secretAgent *models.SecretAgent,
	awsS3 *models.AwsS3,
	gcpStorage *models.GcpStorage,
	azureBlob *models.AzureBlob,
) (*RestoreServiceConfig, error)

NewRestoreServiceConfig creates and returns a new RestoreServiceConfig initialized with the provided parameters. If a config file path is specified in the app, parameters are loaded from the file instead. Returns an error if the config file cannot be loaded or parsed.

func (*RestoreServiceConfig) IsStdin

func (r *RestoreServiceConfig) IsStdin() bool

IsStdin checks if the restore operation should read from stdin by verifying that Restore is non-nil and InputFile is StdPlaceholder.

func (*RestoreServiceConfig) Validate added in v1.1.0

func (r *RestoreServiceConfig) Validate() error

Validate validates the backup configuration and returns an error if any validation fails.

type ServerBackupServiceConfig added in v1.1.0

type ServerBackupServiceConfig struct {
	ServerBackup *models.ServerBackup

	ServiceConfigCommon
}

ServerBackupServiceConfig holds the configuration for the server-integrated Backup service.

func NewServerBackupServiceConfig added in v1.1.0

func NewServerBackupServiceConfig(
	serverBackup *models.ServerBackup,
	app *models.App,
	clientConfig *client.AerospikeConfig,
	clientPolicy *models.ClientPolicy,
	secretAgent *models.SecretAgent,
	awsS3 *models.AwsS3,
) *ServerBackupServiceConfig

NewServerBackupServiceConfig initializes a new ServerBackupServiceConfig using the provided parameters for backup service configuration.

func (*ServerBackupServiceConfig) Validate added in v1.1.0

func (s *ServerBackupServiceConfig) Validate(isBackup bool) error

Validate checks if the ServerBackupServiceConfig and its embedded ServiceConfigCommon are correctly configured.

type ServiceConfigCommon added in v1.1.0

type ServiceConfigCommon struct {
	App          *models.App
	ClientConfig *client.AerospikeConfig
	ClientPolicy *models.ClientPolicy
	Compression  *models.Compression
	Encryption   *models.Encryption
	SecretAgent  *models.SecretAgent
	AwsS3        *models.AwsS3
	GcpStorage   *models.GcpStorage
	AzureBlob    *models.AzureBlob
	Local        *models.Local
}

ServiceConfigCommon is the common configuration for all services.

func NewServiceConfigCommon added in v1.1.0

func NewServiceConfigCommon(
	app *models.App,
	clientConfig *client.AerospikeConfig,
	clientPolicy *models.ClientPolicy,
	compression *models.Compression,
	encryption *models.Encryption,
	secretAgent *models.SecretAgent,
	awsS3 *models.AwsS3,
	gcpStorage *models.GcpStorage,
	azureBlob *models.AzureBlob,
	local *models.Local,
) *ServiceConfigCommon

NewServiceConfigCommon initializes and returns a ServiceConfigCommon object with the provided configuration parameters.

func (*ServiceConfigCommon) GetApp added in v1.1.0

func (r *ServiceConfigCommon) GetApp() *models.App

GetApp returns the App configuration.

func (*ServiceConfigCommon) Validate added in v1.1.0

func (r *ServiceConfigCommon) Validate(isBackup bool) error

Validate validates the backup configuration and returns an error if any validation fails.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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