sqlitearchive

package
v0.8.16 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 22 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

View Source
var (
	ErrStreamBudget      = errors.New("deep stream budget exhausted")
	ErrStreamInterrupted = errors.New("deep stream interrupted")
	ErrCandidateInvalid  = errors.New("archive candidate is invalid")
)
View Source
var ErrOperationLocked = errors.New("SQLite archive operation already running")

Functions

func IsSQLiteArchiveKey added in v0.7.0

func IsSQLiteArchiveKey(key string, prefix string) bool

IsSQLiteArchiveKey reports whether key has the canonical SQLite archive name under prefix. Audit adapters use the same predicate as restore selection.

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) (result ArchiveResult, retErr error)

type CandidateValidation added in v0.7.0

type CandidateValidation struct {
	QuickCheck               string
	IntegrityObserved        bool
	ForeignKeyViolationCount int
	SchemaCompatibility      string
	SchemaObserved           bool
	MigrationCompatibility   string
	MigrationObserved        bool
}

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 Listing added in v0.7.0

type Listing struct {
	Objects  []Object
	Complete bool
}

type Object

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

type ObjectLister added in v0.7.0

type ObjectLister interface {
	ListObjects(ctx context.Context, prefix string) ([]Object, error)
}

type ObjectReader added in v0.7.0

type ObjectReader interface {
	GetObject(ctx context.Context, key string) (io.ReadCloser, error)
}

type ObjectStore

type ObjectStore interface {
	ObjectWriter
	ObjectLister
	ObjectReader
}

type ObjectWriter added in v0.7.0

type ObjectWriter interface {
	PutObject(ctx context.Context, key string, body io.Reader, contentType string, contentLength int64) (string, error)
}

type OperationLease added in v0.7.0

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

func AcquireOperationLease added in v0.7.0

func AcquireOperationLease(cfg config.Config, owner string) (*OperationLease, error)

func (*OperationLease) Close added in v0.7.0

func (l *OperationLease) Close() error

type Options

type Options struct {
	Prefix         string
	Now            func() time.Time
	Store          ObjectStore
	Writer         ObjectWriter
	OperationLease *OperationLease
	Progress       func(Event)
	// contains filtered or unexported fields
}

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) (result RestoreResult, retErr error)

type S3Inspector added in v0.7.0

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

S3Inspector is deliberately list-only. It cannot write or restore objects.

func NewS3Inspector added in v0.7.0

func NewS3Inspector(opts S3Options) (*S3Inspector, error)

func (*S3Inspector) ListObjects added in v0.7.0

func (i *S3Inspector) ListObjects(ctx context.Context, prefix string, maxObjects int) (Listing, error)

func (*S3Inspector) ListObjectsBounded added in v0.7.0

func (i *S3Inspector) ListObjectsBounded(ctx context.Context, prefix string, maxObjects, maxPages int, pageTimeout time.Duration) (Listing, error)

func (*S3Inspector) ListObjectsWithPageTimeout added in v0.7.0

func (i *S3Inspector) ListObjectsWithPageTimeout(ctx context.Context, prefix string, maxObjects int, pageTimeout time.Duration) (Listing, error)

type S3Options

type S3Options struct {
	Bucket                string
	Endpoint              string
	Region                string
	AccessKeyID           string
	SecretKey             string
	SessionToken          string
	PathStyle             bool
	ConnectTimeout        time.Duration
	TLSHandshakeTimeout   time.Duration
	ResponseHeaderTimeout time.Duration
}

type S3Reader added in v0.7.0

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

S3Reader is deliberately get-only. It cannot list, write, delete, or restore archive objects.

func NewS3Reader added in v0.7.0

func NewS3Reader(opts S3Options) (*S3Reader, error)

func (*S3Reader) Open added in v0.7.0

func (r *S3Reader) Open(ctx context.Context, key string) (io.ReadCloser, error)

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)

type StreamLimits added in v0.7.0

type StreamLimits struct {
	MaxCompressedBytes int64
	MaxDatabaseBytes   int64
	MaxTempBytes       int64
	ReadIdleTimeout    time.Duration
}

type StreamResult added in v0.7.0

type StreamResult struct {
	CompressedBytes          int64
	DecompressedBytes        int64
	QuickCheck               string
	IntegrityObserved        bool
	ForeignKeyViolationCount int
	SchemaCompatibility      string
	SchemaObserved           bool
	MigrationCompatibility   string
	MigrationObserved        bool
}

func StreamCandidate added in v0.7.0

func StreamCandidate(ctx context.Context, body io.ReadCloser, temp *vaultfs.PrivateTemp, limits StreamLimits) (StreamResult, error)

Jump to

Keyboard shortcuts

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