sqlitearchive

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultPrefix = "archive/db"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveResult

type ArchiveResult struct {
	Key          string    `json:"key"`
	LocalDBPath  string    `json:"local_db_path"`
	SnapshotSize int64     `json:"snapshot_size"`
	ArchiveSize  int64     `json:"archive_size"`
	ETag         string    `json:"etag,omitempty"`
	ArchivedAt   time.Time `json:"archived_at"`
}

func Archive

func Archive(ctx context.Context, cfg config.Config, opts Options) (ArchiveResult, error)

type Event

type Event struct {
	Kind    EventKind
	Stage   string
	Message string
	Current int64
	Total   int64
}

type EventKind

type EventKind string
const (
	EventStageStart       EventKind = "stage_start"
	EventStageDone        EventKind = "stage_done"
	EventTransferProgress EventKind = "transfer_progress"
)

type Object

type Object struct {
	Key          string    `json:"key"`
	LastModified time.Time `json:"last_modified"`
	Size         int64     `json:"size"`
}

type ObjectStore

type ObjectStore interface {
	PutObject(ctx context.Context, key string, body io.Reader, contentType string, contentLength int64) (string, error)
	ListObjects(ctx context.Context, prefix string) ([]Object, error)
	GetObject(ctx context.Context, key string) (io.ReadCloser, error)
}

type Options

type Options struct {
	Prefix   string
	Now      func() time.Time
	Store    ObjectStore
	Progress func(Event)
}

type RestorePlan

type RestorePlan struct {
	Object Object `json:"object"`
}

func Latest

func Latest(ctx context.Context, opts Options) (RestorePlan, error)

type RestoreResult

type RestoreResult struct {
	Key          string    `json:"key"`
	RestoredPath string    `json:"restored_path"`
	BackupPaths  []string  `json:"backup_paths,omitempty"`
	RestoredAt   time.Time `json:"restored_at"`
}

func Restore

func Restore(ctx context.Context, cfg config.Config, plan RestorePlan, opts Options) (RestoreResult, error)

type S3Options

type S3Options struct {
	Bucket       string
	Endpoint     string
	Region       string
	AccessKeyID  string
	SecretKey    string
	SessionToken string
	PathStyle    bool
}

type S3Store

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

func NewS3Store

func NewS3Store(opts S3Options) (*S3Store, error)

func (*S3Store) GetObject

func (s *S3Store) GetObject(ctx context.Context, key string) (io.ReadCloser, error)

func (*S3Store) ListObjects

func (s *S3Store) ListObjects(ctx context.Context, prefix string) ([]Object, error)

func (*S3Store) PutObject

func (s *S3Store) PutObject(ctx context.Context, key string, body io.Reader, contentType string, contentLength int64) (string, error)

Jump to

Keyboard shortcuts

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