cas

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package cas stores data in in a backing blob store with content-addressed storage and convergent encryption. That is, objects with with identical contents (using the same secret) have identical blob key and ciphertext.

Stored data is identified by a keyed hash of the plaintext data. Contents are encrypted with AEAD. All keys used are derived from the user-controlled secret by Argon2 KDFs.

Limitations

- No key rotation (at this level) - No garbage collection (at this level)

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadKey      = errors.New("bad key")
	ErrNotExist    = errors.New("object does not exist")
	ErrCorruptBlob = errors.New("blob is corrupted")
)

Functions

This section is empty.

Types

type Extent added in v0.0.2

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

func (*Extent) Bytes added in v0.0.2

func (e *Extent) Bytes() ([]byte, error)

func (*Extent) End added in v0.0.2

func (e *Extent) End() int64

func (*Extent) Key added in v0.0.2

func (e *Extent) Key() string

func (*Extent) Next added in v0.0.2

func (e *Extent) Next() (_ *Extent, ok bool)

func (*Extent) Start added in v0.0.2

func (e *Extent) Start() int64

type Handle

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

func (*Handle) IO

func (h *Handle) IO(ctx context.Context) *Reader

func (*Handle) Size

func (h *Handle) Size() int64

type Option added in v0.0.2

type Option option

func WithChunkGoal added in v0.0.2

func WithChunkGoal(size uint32) Option

WithChunkGoal sets the desired average chunk size for chunking.

Zero will leave the previous value in effect.

func WithChunkLimits added in v0.0.2

func WithChunkLimits(min, max uint32) Option

WithChunkLimits sets the minimum and maximum chunk size.

Zero will leave the previous value in effect.

An invalid combination (min > max, including when one is left to zero and uses the previous value) will set both values to max.

type Reader

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

func (*Reader) ExtentAt added in v0.0.2

func (r *Reader) ExtentAt(offset int64) (*Extent, error)

ExtentAt returns the extent containing offset, or io.EOF if offset is outside of stored data.

Note that the extent starting offset can be (and typically is) before the requested offset.

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

func (*Reader) ReadAt

func (r *Reader) ReadAt(p []byte, offset int64) (int, error)

type Store

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

func NewStore

func NewStore(bucket *blob.Bucket, sharingPassphrase string, opts ...Option) *Store

func (*Store) Create

func (s *Store) Create(ctx context.Context, r io.Reader) (string, error)

func (*Store) DebugBoxKey added in v0.0.2

func (s *Store) DebugBoxKey(key string) (string, error)

func (*Store) DebugReadBlob added in v0.0.2

func (s *Store) DebugReadBlob(ctx context.Context, blobKey string) ([]byte, error)

func (*Store) Open

func (s *Store) Open(ctx context.Context, key string) (*Handle, error)

type UnexpectedContentTypeError

type UnexpectedContentTypeError struct {
	ContentType string
}

func (*UnexpectedContentTypeError) Error

Jump to

Keyboard shortcuts

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