encoded

package
v0.9.2 Latest Latest
Warning

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

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

Documentation

Overview

Package encoded implements a blob.StoreCloser that applies a reversible encoding such as compression or encryption to the data.

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 KV added in v0.7.0

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

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

func NewKV added in v0.8.0

func NewKV(kv blob.KV, c Codec) KV

NewKV constructs a new KV that delegates to kv and uses c to encode and decode blob data. NewKV will panic if either kv or c is nil.

func (KV) Delete added in v0.7.0

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

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

func (KV) Get added in v0.7.0

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

Get implements part of the blob.KV interface.

func (KV) Len added in v0.7.0

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

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

func (KV) List added in v0.7.0

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

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

func (KV) Put added in v0.7.0

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

Put implements part of the blob.KV interface.

type Store

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

A Store wraps an existing blob.Store implementation so that its key spaces 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) CAS added in v0.9.0

func (s Store) CAS(ctx context.Context, name string) (blob.CAS, error)

CAS implements a method of blob.Store.

func (Store) Close

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

Close implements a method of the blob.StoreCloser interface.

func (Store) KV added in v0.9.0

func (s Store) KV(ctx context.Context, name string) (blob.KV, error)

KV implements a method of blob.Store. The concrete type of keyspaces returned is KV.

func (Store) Sub added in v0.8.0

func (s Store) Sub(ctx context.Context, name string) (blob.Store, error)

Sub implements a method of blob.Store. The concrete type of stores returned is Store.

Jump to

Keyboard shortcuts

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