Documentation ¶
Overview ¶
Package repo implements content-addressable Repository on top of BLOB storage.
Index ¶
- Constants
- Variables
- func Connect(ctx context.Context, configFile string, st blob.Storage, password string, ...) error
- func DecodeToken(token string) (blob.ConnectionInfo, string, error)
- func Disconnect(ctx context.Context, configFile string) error
- func GetPersistedPassword(ctx context.Context, configFile string) (string, bool)
- func Initialize(ctx context.Context, st blob.Storage, opt *NewRepositoryOptions, ...) error
- func RecoverFormatBlob(ctx context.Context, st blob.Storage, blobID blob.ID, optionalLength int64) ([]byte, error)
- type ConnectOptions
- type LocalConfig
- type NewRepositoryOptions
- type Options
- type Repository
- func (r *Repository) Close(ctx context.Context) error
- func (r *Repository) Flush(ctx context.Context) error
- func (r *Repository) Refresh(ctx context.Context) error
- func (r *Repository) RefreshPeriodically(ctx context.Context, interval time.Duration)
- func (r *Repository) SetCachingConfig(ctx context.Context, opt content.CachingOptions) error
- func (r *Repository) Token(password string) (string, error)
- func (r *Repository) Upgrade(ctx context.Context) error
Constants ¶
const FormatBlobID = "kopia.repository"
FormatBlobID is the identifier of a BLOB that describes repository format.
Variables ¶
var ( BuildInfo = "unknown" BuildVersion = "v0-unofficial" )
BuildInfo is the build information of Kopia.
var ErrAlreadyInitialized = errors.Errorf("repository already initialized")
ErrAlreadyInitialized indicates that repository has already been initialized.
var ErrInvalidPassword = errors.Errorf("invalid repository password")
ErrInvalidPassword is returned when repository password is invalid.
var ErrRepositoryNotInitialized = errors.Errorf("repository not initialized in the provided storage")
ErrRepositoryNotInitialized is returned when attempting to connect to repository that has not been initialized.
var KeyRingEnabled = false
KeyRingEnabled enables password persistence uses OS-specific keyring.
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 ¶
Disconnect removes the specified configuration file and any local cache directories.
func GetPersistedPassword ¶ added in v0.5.2
GetPersistedPassword retrieves persisted password for a given repository config.
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 { PersistCredentials bool `json:"persistCredentials"` HostnameOverride string `json:"hostnameOverride"` UsernameOverride string `json:"usernameOverride"` 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"` Hostname string `json:"hostname"` Username string `json:"username"` }
LocalConfig is a configuration of Kopia stored in a configuration file.
type NewRepositoryOptions ¶
type NewRepositoryOptions struct { UniqueID []byte `json:"uniqueID"` // force the use of particular unique ID BlockFormat content.FormattingOptions `json:"blockFormat"` DisableHMAC bool `json:"disableHMAC"` ObjectFormat object.Format `json:"objectFormat"` // 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 Hostname string // connected (localhost) hostname Username string // connected username // 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(ctx context.Context, opt content.CachingOptions) error
SetCachingConfig changes caching configuration for a given repository.
Source Files ¶
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). |
azure
Package azure implements Azure Blob Storage.
|
Package azure implements Azure Blob Storage. |
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. |
sftp
Package sftp implements blob storage provided for SFTP/SSH.
|
Package sftp implements blob storage provided for SFTP/SSH. |
sharded
Package sharded implements common support for sharded blob providers, such as filesystem or webdav.
|
Package sharded implements common support for sharded blob providers, such as filesystem or webdav. |
webdav
Package webdav implements WebDAV-based Storage.
|
Package webdav implements WebDAV-based Storage. |
Package compression manages compression algorithm implementations.
|
Package compression manages compression algorithm implementations. |
Package content implements repository support for content-addressable storage.
|
Package content implements repository support for content-addressable storage. |
Package encryption manages content encryption algorithms.
|
Package encryption manages content encryption algorithms. |
Package hashing encapsulates all keyed hashing algorithms.
|
Package hashing encapsulates all keyed hashing algorithms. |
Package logging provides loggers for Kopia.
|
Package logging provides loggers for Kopia. |
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. |
Package splitter manages splitting of object data into chunks.
|
Package splitter manages splitting of object data into chunks. |