encoded

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package encoded implements a blob.Store that applies a reversible encoding such as compression to the data. Storage is delegated to an underlying blob.Store implementation to which the encoding is opaque.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec interface {
	// Encode writes the encoding of src to w. After encoding, src may be garbage.
	Encode(w io.Writer, src []byte) error

	// Decode writes the decoding of src to w.  After decoding, src may be garbage.
	Decode(w io.Writer, src []byte) error
}

A Codec defines the capabilities needed to encode and decode.

type Store

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

A Store wraps an existing blob.Store implementation in which blobs are encoded using a Codec.

func New

func New(s blob.Store, c Codec) *Store

New constructs a new store that delegates to s and uses c to encode and decode blob data. New will panic if either s or c is nil.

func (*Store) Close

func (s *Store) Close(ctx context.Context) error

Close implements the blob.Closer interface.

func (*Store) Delete

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

Delete implements part of the blob.Store interface. It delegates directly to the underlying store.

func (*Store) Get

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

Get implements part of the blob.Store interface.

func (*Store) Len

func (s *Store) Len(ctx context.Context) (int64, error)

Len implements part of the blob.Store interface. It delegates directly to the underlying store.

func (*Store) List

func (s *Store) List(ctx context.Context, start string, f func(string) error) error

List implements part of the blob.Store interface. It delegates directly to the underlying store.

func (*Store) Put

func (s *Store) Put(ctx context.Context, opts blob.PutOptions) error

Put implements part of the blob.Store interface.

Jump to

Keyboard shortcuts

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