storetar

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 27 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

Overview

Package storetar is the tar store driver: a directory, of the node or of an sftp server, holding, per run, a gzipped tar archive per head and a gzipped file per streamed member.

The runs of an object are under <cluster id>/<object id>/<run id>: several clusters may write one store, an object keeps its runs when renamed, and an object created again at a path does not take the runs of the former one. An object.json beside the runs of an object says the path it had at its last completed run, which a listing by path reads, and a cluster.json beside the objects of a cluster the name it had then, which a listing by cluster name reads. Both are this driver's: another store records the same in its own way, as tags.

It neither deduplicates nor encrypts. It is the reference store of the backup framework, exercising every capability with nothing but the standard library, and a store for tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() backup.Driver

New allocates a tar store driver.

Types

type T

type T struct {
	backup.T
	// contains filtered or unexported fields
}

T is the tar store driver.

func (*T) Backup

func (t *T) Backup(ctx context.Context, run backup.Run, member, src, head string, excludes []string) error

Backup saves the directory src as a gzipped tar archive, member of the run.

func (*T) BackupStream

func (t *T) BackupStream(ctx context.Context, run backup.Run, member string, r io.Reader) error

BackupStream saves what r reads as a gzipped file, member of the run.

func (*T) Cat

func (t *T) Cat(ctx context.Context, run backup.Run, member string) (io.ReadCloser, error)

Cat returns a reader of the member of the run: the document of a streamed member, the tar archive of a head.

func (*T) Check

func (t *T) Check(ctx context.Context, filter backup.RunFilter) error

Check reads every member of the runs filter selects to its end, which the gzip checksums verify.

func (*T) Close

func (t *T) Close() error

Close closes the connection to the sftp server of the store, if any.

func (*T) Complete

func (t *T) Complete(ctx context.Context, run backup.Run) error

Complete marks the run completed in its manifest.

func (*T) Delete

func (t *T) Delete(ctx context.Context, runs []backup.Run) error

Delete removes the runs.

func (*T) IsLocal

func (t *T) IsLocal() bool

IsLocal says whether the store is a directory of the node.

func (*T) IsShared

func (t *T) IsShared() bool

IsShared implements backup.Sharer: an sftp store is the same for every node, and a directory of the node is when its shared keyword says so, as an nfs mount.

func (*T) ObjectStats

func (t *T) ObjectStats(ctx context.Context) ([]backup.ObjectStats, error)

ObjectStats returns the stats every object of the store records, of every cluster, the cluster named as it is now. An object whose marker holds none, written before the stats were, is recounted from its directory, without writing it.

func (*T) OverSSH

func (t *T) OverSSH(conn *ssh.Client) error

OverSSH implements backup.Sharer: the store is the directory of the url on the node conn is connected to, read and written over sftp, conn closed at Close.

func (*T) Restore

func (t *T) Restore(ctx context.Context, run backup.Run, member string, dst string) error

Restore writes the member of the run into dst: the tree of a head, or the file of a streamed member, named after it.

func (*T) Runs

func (t *T) Runs(ctx context.Context, filter backup.RunFilter) ([]backup.Run, error)

Runs returns the runs filter selects, oldest first: the object directories its cluster and object ids name, or every one, and of them the ones whose marker says its path. Its errors name the store, which the listings spanning several stores print as they come.

func (*T) Usage

func (t *T) Usage(ctx context.Context) (backup.Usage, error)

Usage says the space left where the store keeps its runs. What they take is summed from the stats of the objects.

Jump to

Keyboard shortcuts

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