prefixed

package
v0.0.0-...-4a8f785 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package prefixed implements a blob.Store interface that delegates to another Store, with keys namespaced by a fixed prefix concatenated with each key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store implements the blob.Store interface by delegating to an underlying store, but with each key prefixed by a fixed non-empty string. This allows multiple consumers to share non-overlapping namespaces within a single storage backend.

func New

func New(store blob.Store, prefix string) *Store

New creates a Store associated with the specified prefix and store. This function will panic if prefix == "".

func (*Store) Delete

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

Delete implements part of blob.Store by delegation.

func (*Store) Get

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

Get implements part of blob.Store by delegation.

func (*Store) Len

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

Len implements part of blob.Store by delegation. It reports the total number of keys in the underlying store, not only those with the chosen prefix.

func (*Store) List

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

List implements part of blob.Store by delegation. It filters the underlying list results to include only keys prefixed for this store.

func (*Store) Put

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

Put implements part of blob.Store by delegation.

func (*Store) Size

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

Size implements part of blob.Store by delegation.

Jump to

Keyboard shortcuts

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