storage

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package storage provide generic interface to interact with storage backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchAny added in v0.11.0

func MatchAny(any *anypb.Any, query string) bool

MatchAny searches any data with a query.

Types

type Backend

type Backend interface {
	// Close closes the backend.
	Close() error

	// Put is used to insert or update a record.
	Put(ctx context.Context, id string, data *anypb.Any) error

	// Get is used to retrieve a record.
	Get(ctx context.Context, id string) (*databroker.Record, error)

	// List is used to retrieve all the records since a version.
	List(ctx context.Context, sinceVersion string) ([]*databroker.Record, error)

	// Delete is used to mark a record as deleted.
	Delete(ctx context.Context, id string) error

	// ClearDeleted is used clear marked delete records.
	ClearDeleted(ctx context.Context, cutoff time.Time)

	// Watch returns a channel to the caller. The channel is used to notify
	// about changes that happen in storage. When ctx is finished, Watch will close
	// the channel.
	Watch(ctx context.Context) <-chan struct{}
}

Backend is the interface required for a storage backend.

func NewEncryptedBackend

func NewEncryptedBackend(secret []byte, underlying Backend) (Backend, error)

NewEncryptedBackend creates a new encrypted backend.

Directories

Path Synopsis
Package inmemory is the in-memory database using b-trees.
Package inmemory is the in-memory database using b-trees.
Package redis implements the storage.Backend interface for redis.
Package redis implements the storage.Backend interface for redis.

Jump to

Keyboard shortcuts

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