location

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package location implements parsing the restic repository location from a string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoPassword added in v0.16.0

func NoPassword(s string) string

NoPassword returns the repository location unchanged (there's no sensitive information there)

func StripPassword added in v0.11.0

func StripPassword(registry *Registry, s string) string

StripPassword returns a displayable version of a repository location (with any sensitive information removed)

Types

type Factory added in v0.16.0

type Factory interface {
	Scheme() string
	ParseConfig(s string) (interface{}, error)
	StripPassword(s string) string
	Create(ctx context.Context, cfg interface{}, rt http.RoundTripper, lim limiter.Limiter) (restic.Backend, error)
	Open(ctx context.Context, cfg interface{}, rt http.RoundTripper, lim limiter.Limiter) (restic.Backend, error)
}

func NewHTTPBackendFactory added in v0.16.0

func NewHTTPBackendFactory[C any, T restic.Backend](
	scheme string,
	parseConfigFn func(s string) (*C, error),
	stripPasswordFn func(s string) string,
	createFn func(ctx context.Context, cfg C, rt http.RoundTripper) (T, error),
	openFn func(ctx context.Context, cfg C, rt http.RoundTripper) (T, error)) Factory

func NewLimitedBackendFactory added in v0.16.0

func NewLimitedBackendFactory[C any, T restic.Backend](
	scheme string,
	parseConfigFn func(s string) (*C, error),
	stripPasswordFn func(s string) string,
	createFn func(ctx context.Context, cfg C, lim limiter.Limiter) (T, error),
	openFn func(ctx context.Context, cfg C, lim limiter.Limiter) (T, error)) Factory

type Location

type Location struct {
	Scheme string
	Config interface{}
}

Location specifies the location of a repository, including the method of access and (possibly) credentials needed for access.

func Parse

func Parse(registry *Registry, s string) (u Location, err error)

Parse extracts repository location information from the string s. If s starts with a backend name followed by a colon, that backend's Parse() function is called. Otherwise, the local backend is used which interprets s as the name of a directory.

type Registry added in v0.16.0

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

func NewRegistry added in v0.16.0

func NewRegistry() *Registry

func (*Registry) Lookup added in v0.16.0

func (r *Registry) Lookup(scheme string) Factory

func (*Registry) Register added in v0.16.0

func (r *Registry) Register(factory Factory)

Jump to

Keyboard shortcuts

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