kv

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEncodedKV

func NewEncodedKV(bucket nats.KeyValue, k KeyCodec, v ValueCodec) nats.KeyValue

Types

type EncodedKV

type EncodedKV struct {
	WatcherWithCtx
	// contains filtered or unexported fields
}

func (*EncodedKV) Bucket

func (e *EncodedKV) Bucket() string

func (*EncodedKV) Create

func (e *EncodedKV) Create(key string, value []byte) (revision uint64, err error)

func (*EncodedKV) Delete

func (e *EncodedKV) Delete(key string, opts ...nats.DeleteOpt) error

func (*EncodedKV) Get

func (e *EncodedKV) Get(key string) (nats.KeyValueEntry, error)

func (*EncodedKV) GetRevision

func (e *EncodedKV) GetRevision(key string, revision uint64) (nats.KeyValueEntry, error)

func (*EncodedKV) History

func (e *EncodedKV) History(key string, opts ...nats.WatchOpt) ([]nats.KeyValueEntry, error)

func (*EncodedKV) Keys

func (e *EncodedKV) Keys(opts ...nats.WatchOpt) ([]string, error)

func (*EncodedKV) Purge

func (e *EncodedKV) Purge(key string, opts ...nats.DeleteOpt) error

func (*EncodedKV) PurgeDeletes

func (e *EncodedKV) PurgeDeletes(opts ...nats.PurgeOpt) error

func (*EncodedKV) Put

func (e *EncodedKV) Put(key string, value []byte) (revision uint64, err error)

func (*EncodedKV) PutString

func (e *EncodedKV) PutString(key string, value string) (revision uint64, err error)

func (*EncodedKV) Status

func (e *EncodedKV) Status() (nats.KeyValueStatus, error)

func (*EncodedKV) Update

func (e *EncodedKV) Update(key string, value []byte, last uint64) (revision uint64, err error)

func (*EncodedKV) Watch

func (e *EncodedKV) Watch(keys string, opts ...nats.WatchOpt) (nats.KeyWatcher, error)

func (*EncodedKV) WatchAll

func (e *EncodedKV) WatchAll(opts ...nats.WatchOpt) (nats.KeyWatcher, error)

type EtcdKeyCodec

type EtcdKeyCodec struct{}

EtcdKeyCodec turns keys like /this/is/a.test.key into Base58 encoded values split on `/` This is because NATS Jetstream Keys are split on . rather than /

func (*EtcdKeyCodec) Decode

func (*EtcdKeyCodec) Decode(key string) (retKey string, e error)

func (*EtcdKeyCodec) Encode

func (*EtcdKeyCodec) Encode(key string) (retKey string, e error)

func (*EtcdKeyCodec) EncodeRange

func (e *EtcdKeyCodec) EncodeRange(keys string) (string, error)

type KeyCodec

type KeyCodec interface {
	Encode(key string) (string, error)
	Decode(key string) (string, error)
	EncodeRange(keys string) (string, error)
}

type PlainCodec

type PlainCodec struct{}

func (*PlainCodec) Decode

func (*PlainCodec) Decode(src io.Reader, dst io.Writer) error

func (*PlainCodec) Encode

func (*PlainCodec) Encode(src []byte, dst io.Writer) error

type S2ValueCodec

type S2ValueCodec struct{}

func (*S2ValueCodec) Decode

func (*S2ValueCodec) Decode(src io.Reader, dst io.Writer) error

func (*S2ValueCodec) Encode

func (*S2ValueCodec) Encode(src []byte, dst io.Writer) error

type ValueCodec

type ValueCodec interface {
	Encode(src []byte, dst io.Writer) error
	Decode(src io.Reader, dst io.Writer) error
}

type WatcherWithCtx

type WatcherWithCtx interface {
	WatchWithCtx(ctx context.Context, keys string, opts ...nats.WatchOpt) nats.KeyWatcher
}

Jump to

Keyboard shortcuts

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