repo

package
v0.3.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 24 Imported by: 13

Documentation

Overview

Package repo implements content-addressable Repository on top of BLOB storage.

Index

Constants

View Source
const FormatBlobID = "kopia.repository"

FormatBlobID is the identifier of a BLOB that describes repository format.

Variables

View Source
var (
	BuildInfo    = "unknown"
	BuildVersion = "v0-unofficial"
)

BuildInfo is the build information of Kopia.

Functions

func Connect

func Connect(ctx context.Context, configFile string, st blob.Storage, password string, opt ConnectOptions) error

Connect connects to the repository in the specified storage and persists the configuration and credentials in the file provided.

func DecodeToken

func DecodeToken(token string) (blob.ConnectionInfo, string, error)

DecodeToken decodes the provided token and returns connection info and password if persisted.

func Disconnect

func Disconnect(configFile string) error

Disconnect removes the specified configuration file and any local cache directories.

func Initialize

func Initialize(ctx context.Context, st blob.Storage, opt *NewRepositoryOptions, password string) error

Initialize creates initial repository data structures in the specified storage with given credentials.

func RecoverFormatBlob

func RecoverFormatBlob(ctx context.Context, st blob.Storage, blobID blob.ID, optionalLength int64) ([]byte, error)

RecoverFormatBlob attempts to recover format blob replica from the specified file. The format blob can be either the prefix or a suffix of the given file. optionally the length can be provided (if known) to speed up recovery.

Types

type ConnectOptions

type ConnectOptions struct {
	content.CachingOptions
}

ConnectOptions specifies options when persisting configuration to connect to a repository.

type LocalConfig

type LocalConfig struct {
	Storage blob.ConnectionInfo    `json:"storage"`
	Caching content.CachingOptions `json:"caching"`
}

LocalConfig is a configuration of Kopia stored in a configuration file.

func (*LocalConfig) Load

func (lc *LocalConfig) Load(r io.Reader) error

Load reads local configuration from the specified reader.

func (*LocalConfig) Save

func (lc *LocalConfig) Save(w io.Writer) error

Save writes the configuration to the specified writer.

type NewRepositoryOptions

type NewRepositoryOptions struct {
	UniqueID     []byte // force the use of particular unique ID
	BlockFormat  content.FormattingOptions
	DisableHMAC  bool
	ObjectFormat object.Format // object format
}

NewRepositoryOptions specifies options that apply to newly created repositories. All fields are optional, when not provided, reasonable defaults will be used.

type Options

type Options struct {
	TraceStorage         func(f string, args ...interface{}) // Logs all storage access using provided Printf-style function
	ObjectManagerOptions object.ManagerOptions
}

Options provides configuration parameters for connection to a repository.

type Repository

type Repository struct {
	Blobs     blob.Storage
	Content   *content.Manager
	Objects   *object.Manager
	Manifests *manifest.Manager
	UniqueID  []byte

	ConfigFile string
	// contains filtered or unexported fields
}

Repository represents storage where both content-addressable and user-addressable data is kept.

func Open

func Open(ctx context.Context, configFile, password string, options *Options) (rep *Repository, err error)

Open opens a Repository specified in the configuration file.

func OpenWithConfig

func OpenWithConfig(ctx context.Context, st blob.Storage, lc *LocalConfig, password string, options *Options, caching content.CachingOptions) (*Repository, error)

OpenWithConfig opens the repository with a given configuration, avoiding the need for a config file.

func (*Repository) Close

func (r *Repository) Close(ctx context.Context) error

Close closes the repository and releases all resources.

func (*Repository) Flush

func (r *Repository) Flush(ctx context.Context) error

Flush waits for all in-flight writes to complete.

func (*Repository) Refresh

func (r *Repository) Refresh(ctx context.Context) error

Refresh periodically makes external changes visible to repository.

func (*Repository) RefreshPeriodically

func (r *Repository) RefreshPeriodically(ctx context.Context, interval time.Duration)

RefreshPeriodically periodically refreshes the repository to reflect the changes made by other hosts.

func (*Repository) SetCachingConfig

func (r *Repository) SetCachingConfig(opt content.CachingOptions) error

SetCachingConfig changes caching configuration for a given repository.

func (*Repository) Token

func (r *Repository) Token(password string) (string, error)

Token returns an opaque token that contains repository connection information and optionally the provided password.

func (*Repository) Upgrade

func (r *Repository) Upgrade(ctx context.Context) error

Upgrade upgrades repository data structures to the latest version.

Directories

Path Synopsis
Package blob implements simple storage of immutable, unstructured binary large objects (BLOBs).
Package blob implements simple storage of immutable, unstructured binary large objects (BLOBs).
filesystem
Package filesystem implements filesystem-based Storage.
Package filesystem implements filesystem-based Storage.
gcs
Package gcs implements Storage based on Google Cloud Storage bucket.
Package gcs implements Storage based on Google Cloud Storage bucket.
logging
Package logging implements wrapper around Storage that logs all activity.
Package logging implements wrapper around Storage that logs all activity.
providers
Package providers registers all storage providers that are included as part of Kopia.
Package providers registers all storage providers that are included as part of Kopia.
s3
Package s3 implements Storage based on an S3 bucket.
Package s3 implements Storage based on an S3 bucket.
webdav
Package webdav implements WebDAV-based Storage.
Package webdav implements WebDAV-based Storage.
Package content implements repository support for content-addressable storage.
Package content implements repository support for content-addressable storage.
Package manifest implements support for managing JSON-based manifests in repository.
Package manifest implements support for managing JSON-based manifests in repository.
Package object implements repository support for content-addressable objects of arbitrary size.
Package object implements repository support for content-addressable objects of arbitrary size.

Jump to

Keyboard shortcuts

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