services

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupData

type BackupData struct {
	KVData      consulapi.KVPairs
	PQData      []*consulapi.PreparedQueryDefinition
	ACLData     []*consulapi.ACLEntry
	KVJSONData  []byte
	PQJSONData  []byte
	ACLJSONData []byte
	StartTime   int64
	LocalPath   string
	RemotePath  string
	Checksums   map[string]string
}

BackupData represents the data being backed up

type BackupService

type BackupService struct {
	Config     *config.Config
	Consul     *consul.Consul
	Storage    interfaces.StorageClient
	FileSystem interfaces.FileSystem
	Archiver   interfaces.Archiver
	Logger     interfaces.Logger
}

BackupService handles backup operations with dependency injection

func NewBackupService

func NewBackupService(config *config.Config, consul *consul.Consul, storage interfaces.StorageClient, fs interfaces.FileSystem, archiver interfaces.Archiver, logger interfaces.Logger) *BackupService

NewBackupService creates a new backup service

func (*BackupService) Cleanup

func (s *BackupService) Cleanup(data *BackupData) error

Cleanup removes temporary files

func (*BackupService) CollectData

func (s *BackupService) CollectData() (*BackupData, error)

CollectData collects data from consul

func (*BackupService) CompressBackup

func (s *BackupService) CompressBackup(data *BackupData) error

CompressBackup creates a compressed archive

func (*BackupService) RunBackup

func (s *BackupService) RunBackup() error

RunBackup executes a complete backup workflow

func (*BackupService) SerializeData

func (s *BackupService) SerializeData(data *BackupData) error

SerializeData converts consul data to JSON

func (*BackupService) UploadBackup

func (s *BackupService) UploadBackup(data *BackupData) error

UploadBackup uploads the backup to cloud storage

func (*BackupService) WriteLocalFiles

func (s *BackupService) WriteLocalFiles(data *BackupData) error

WriteLocalFiles writes JSON data to local files

type LoggerAdapter

type LoggerAdapter struct{}

LoggerAdapter is a simple implementation for the service

func (*LoggerAdapter) Fatal

func (l *LoggerAdapter) Fatal(args ...interface{})

func (*LoggerAdapter) Fatalf

func (l *LoggerAdapter) Fatalf(format string, args ...interface{})

func (*LoggerAdapter) Print

func (l *LoggerAdapter) Print(args ...interface{})

func (*LoggerAdapter) Printf

func (l *LoggerAdapter) Printf(format string, args ...interface{})

type RestoreData

type RestoreData struct {
	RestorePath   string
	LocalPath     string
	ExtractedPath string
	KVData        consulapi.KVPairs
	PQData        []*consulapi.PreparedQueryDefinition
	ACLData       []*consulapi.ACLEntry
	Metadata      map[string]interface{}
}

RestoreData represents the data being restored

type RestoreService

type RestoreService struct {
	Config     *config.Config
	Consul     *consul.Consul
	Storage    interfaces.StorageClient
	FileSystem interfaces.FileSystem
	Archiver   interfaces.Archiver
	Logger     interfaces.Logger
}

RestoreService handles restore operations with dependency injection

func NewRestoreService

func NewRestoreService(config *config.Config, consul *consul.Consul, storage interfaces.StorageClient, fs interfaces.FileSystem, archiver interfaces.Archiver, logger interfaces.Logger) *RestoreService

NewRestoreService creates a new restore service

func (*RestoreService) Cleanup

func (s *RestoreService) Cleanup(data *RestoreData) error

Cleanup removes temporary files

func (*RestoreService) DownloadBackup

func (s *RestoreService) DownloadBackup(restorePath string) (*RestoreData, error)

DownloadBackup downloads backup from cloud storage

func (*RestoreService) ExtractBackup

func (s *RestoreService) ExtractBackup(data *RestoreData) error

ExtractBackup extracts the backup archive

func (*RestoreService) LoadBackupData

func (s *RestoreService) LoadBackupData(data *RestoreData) error

LoadBackupData loads the actual backup data from JSON files

func (*RestoreService) LoadMetadata

func (s *RestoreService) LoadMetadata(data *RestoreData) error

LoadMetadata loads and validates backup metadata

func (*RestoreService) RestoreToConsul

func (s *RestoreService) RestoreToConsul(data *RestoreData) error

RestoreToConsul restores the data to consul

func (*RestoreService) RunRestore

func (s *RestoreService) RunRestore(restorePath string) error

RunRestore executes a complete restore workflow

Jump to

Keyboard shortcuts

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