azure

package
v0.16.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: BSD-2-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory added in v0.16.0

func NewFactory() location.Factory

Types

type Backend

type Backend struct {
	layout.Layout
	// contains filtered or unexported fields
}

Backend stores data on an azure endpoint.

func Create

func Create(ctx context.Context, cfg Config, rt http.RoundTripper) (*Backend, error)

Create opens the Azure backend at specified container and creates the container if it does not exist yet.

func Open

func Open(_ context.Context, cfg Config, rt http.RoundTripper) (*Backend, error)

Open opens the Azure backend at specified container.

func (*Backend) Close

func (be *Backend) Close() error

Close does nothing

func (*Backend) Connections added in v0.14.0

func (be *Backend) Connections() uint

func (*Backend) Delete

func (be *Backend) Delete(ctx context.Context) error

Delete removes all restic keys in the bucket. It will not remove the bucket itself.

func (*Backend) HasAtomicReplace added in v0.14.0

func (be *Backend) HasAtomicReplace() bool

HasAtomicReplace returns whether Save() can atomically replace files

func (*Backend) Hasher added in v0.13.0

func (be *Backend) Hasher() hash.Hash

Hasher may return a hash function for calculating a content hash for the backend

func (*Backend) IsNotExist

func (be *Backend) IsNotExist(err error) bool

IsNotExist returns true if the error is caused by a not existing file.

func (*Backend) Join

func (be *Backend) Join(p ...string) string

Join combines path components with slashes.

func (*Backend) List

func (be *Backend) List(ctx context.Context, t restic.FileType, fn func(restic.FileInfo) error) error

List runs fn for each file in the backend which has the type t. When an error occurs (or fn returns an error), List stops and returns it.

func (*Backend) Load

func (be *Backend) Load(ctx context.Context, h restic.Handle, length int, offset int64, fn func(rd io.Reader) error) error

Load runs fn with a reader that yields the contents of the file at h at the given offset.

func (*Backend) Location

func (be *Backend) Location() string

Location returns this backend's location (the container name).

func (*Backend) Path

func (be *Backend) Path() string

Path returns the path in the bucket that is used for this backend.

func (*Backend) Remove

func (be *Backend) Remove(ctx context.Context, h restic.Handle) error

Remove removes the blob with the given name and type.

func (*Backend) Save

Save stores data in the backend at the handle.

func (*Backend) SetListMaxItems added in v0.7.3

func (be *Backend) SetListMaxItems(i int)

SetListMaxItems sets the number of list items to load per request.

func (*Backend) Stat

func (be *Backend) Stat(ctx context.Context, h restic.Handle) (restic.FileInfo, error)

Stat returns information about a blob.

type Config

type Config struct {
	AccountName    string
	AccountSAS     options.SecretString
	AccountKey     options.SecretString
	EndpointSuffix string
	Container      string
	Prefix         string

	Connections uint `option:"connections" help:"set a limit for the number of concurrent connections (default: 5)"`
}

Config contains all configuration necessary to connect to an azure compatible server.

func NewConfig

func NewConfig() Config

NewConfig returns a new Config with the default values filled in.

func ParseConfig

func ParseConfig(s string) (*Config, error)

ParseConfig parses the string s and extracts the azure config. The configuration format is azure:containerName:/[prefix].

func (*Config) ApplyEnvironment added in v0.16.0

func (cfg *Config) ApplyEnvironment(prefix string)

ApplyEnvironment saves values from the environment to the config.

Jump to

Keyboard shortcuts

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