Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnknownReference = errors.New("unknown reference")
Functions ¶
func AvailableAdapters ¶
func AvailableAdapters() (list []string)
func RegisterAdapter ¶
func RegisterAdapter(name string, adapter AdapterConstructor)
RegisterAdapter will remember the given adapter with under the given name. It will panic, if the name is already taken.
Types ¶
type Adapter ¶
type Adapter interface {
// CopyFile copies a file with the given ID to the target path. It may
// return ErrUnknownReference if the ID is unknown.
CopyFile(log *zap.Logger, id Identifier, w io.Writer) error
// Store saves the content in the adapter backend.
Store(log *zap.Logger, r io.Reader) error
// Exists checks whether the given reference identifier exists in this
// storage adapter.
Exists(id Identifier) bool
}
The Adapter inteface describes the protocol to interact with different storage backends.
type ErrInvalidIdentifier ¶
type ErrInvalidIdentifier struct {
// contains filtered or unexported fields
}
func (*ErrInvalidIdentifier) Error ¶
func (err *ErrInvalidIdentifier) Error() string
func (*ErrInvalidIdentifier) Unwrap ¶
func (err *ErrInvalidIdentifier) Unwrap() error
type ErrStoreAlreadyTaken ¶
type ErrStoreAlreadyTaken string
func (ErrStoreAlreadyTaken) Error ¶
func (err ErrStoreAlreadyTaken) Error() string
type Identifier ¶
type Identifier []byte
File references are identified by their checksum.
func NewIdentifier ¶
func NewIdentifier(contents []byte) Identifier
NewIdentifier calculates the reference ID from the given file contents.
func ParseIdentifier ¶
func ParseIdentifier(b []byte) (Identifier, error)
ParseIdentifier takes an input in the form "sha256:...." and transforms it into an Identifier. Parsing errors are reported as ErrInvalidIdentifier.
func ReadIdentifier ¶
func ReadIdentifier(r io.Reader) (Identifier, error)
func (Identifier) Raw ¶
func (id Identifier) Raw() string
func (Identifier) String ¶
func (id Identifier) String() string
Click to show internal directories.
Click to hide internal directories.