encoded

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Overview

Package encoded implements a blob.KV that applies a reversible encoding such as compression to the data. Storage is delegated to an underlying blob.KV 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 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 New

func New(kv blob.KV, c Codec) *KV

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 (*KV) Close added in v0.7.0

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

Close implements the blob.Closer interface.

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.

Jump to

Keyboard shortcuts

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