nats

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, connection string, tlsInfo tls.Config) (server.Backend, error)

New return an implementation of server.Backend using NATS + JetStream. See the `examples/nats.md` file for examples of connection strings.

func NewLegacy

func NewLegacy(ctx context.Context, connection string, tlsInfo tls.Config) (server.Backend, error)

NewLegacy return an implementation of server.Backend using NATS + JetStream with legacy jetstream:// behavior, ignoring the embedded server.

Types

type Backend

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

func (*Backend) Close

func (b *Backend) Close() error

func (*Backend) Count

func (b *Backend) Count(ctx context.Context, prefix string) (int64, int64, error)

Count returns an exact count of the number of matching keys and the current revision of the database.

func (*Backend) Create

func (b *Backend) Create(ctx context.Context, key string, value []byte, lease int64) (int64, error)

Create attempts to create the key-value entry and returns the revision number.

func (*Backend) DbSize

func (b *Backend) DbSize(ctx context.Context) (int64, error)

DbSize get the kineBucket size from JetStream.

func (*Backend) Delete

func (b *Backend) Delete(ctx context.Context, key string, revision int64) (int64, *server.KeyValue, bool, error)

func (*Backend) Get

func (b *Backend) Get(ctx context.Context, key, rangeEnd string, limit, revision int64) (int64, *server.KeyValue, error)

Get returns the store's current revision, the associated server.KeyValue or an error.

func (*Backend) List

func (b *Backend) List(ctx context.Context, prefix, startKey string, limit, maxRevision int64) (int64, []*server.KeyValue, error)

List returns a range of keys starting with the prefix. This would translated to one or more tokens, e.g. `a.b.c`. The startKey would be the next set of tokens that follow the prefix that are alphanumerically equal to or greater than the startKey. If limit is provided, the maximum set of matches is limited. If revision is provided, this indicates the maximum revision to return.

func (*Backend) Update

func (b *Backend) Update(ctx context.Context, key string, value []byte, revision, lease int64) (int64, *server.KeyValue, bool, error)

func (*Backend) Watch

func (b *Backend) Watch(ctx context.Context, prefix string, startRevision int64) server.WatchResult

type BackendLogger

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

func (*BackendLogger) Count

func (b *BackendLogger) Count(ctx context.Context, prefix string) (revRet int64, count int64, err error)

Count returns an exact count of the number of matching keys and the current revision of the database

func (*BackendLogger) Create

func (b *BackendLogger) Create(ctx context.Context, key string, value []byte, lease int64) (revRet int64, errRet error)

Create attempts to create the key-value entry and returns the revision number.

func (*BackendLogger) DbSize

func (b *BackendLogger) DbSize(ctx context.Context) (int64, error)

DbSize get the kineBucket size from JetStream.

func (*BackendLogger) Delete

func (b *BackendLogger) Delete(ctx context.Context, key string, revision int64) (revRet int64, kvRet *server.KeyValue, deletedRet bool, errRet error)

func (*BackendLogger) Get

func (b *BackendLogger) Get(ctx context.Context, key, rangeEnd string, limit, revision int64) (revRet int64, kvRet *server.KeyValue, errRet error)

Get returns the store's current revision, the associated server.KeyValue or an error.

func (*BackendLogger) List

func (b *BackendLogger) List(ctx context.Context, prefix, startKey string, limit, revision int64) (revRet int64, kvRet []*server.KeyValue, errRet error)

func (*BackendLogger) Start

func (b *BackendLogger) Start(ctx context.Context) error

func (*BackendLogger) Update

func (b *BackendLogger) Update(ctx context.Context, key string, value []byte, revision, lease int64) (revRet int64, kvRet *server.KeyValue, updateRet bool, errRet error)

func (*BackendLogger) Watch

func (b *BackendLogger) Watch(ctx context.Context, prefix string, revision int64) server.WatchResult

type Config

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

type KeyValue

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

func NewKeyValue

func NewKeyValue(ctx context.Context, bucket jetstream.KeyValue, js jetstream.JetStream) *KeyValue

func (*KeyValue) BucketRevision

func (e *KeyValue) BucketRevision() int64

BucketRevision returns the latest revision of the bucket.

func (*KeyValue) BucketSize

func (e *KeyValue) BucketSize(ctx context.Context) (int64, error)

BucketSize returns the size of the bucket in bytes.

func (*KeyValue) Count

func (e *KeyValue) Count(ctx context.Context, prefix string) (int64, error)

func (*KeyValue) Create

func (e *KeyValue) Create(ctx context.Context, key string, value []byte) (uint64, error)

func (*KeyValue) Delete

func (e *KeyValue) Delete(ctx context.Context, key string, opts ...jetstream.KVDeleteOpt) error

func (*KeyValue) Get

func (*KeyValue) GetRevision

func (e *KeyValue) GetRevision(ctx context.Context, key string, revision uint64) (jetstream.KeyValueEntry, error)

func (*KeyValue) List

func (e *KeyValue) List(ctx context.Context, prefix, startKey string, limit, revision int64) ([]jetstream.KeyValueEntry, error)

func (*KeyValue) Update

func (e *KeyValue) Update(ctx context.Context, key string, value []byte, last uint64) (uint64, error)

func (*KeyValue) Watch

func (e *KeyValue) Watch(ctx context.Context, keys string, startRev int64) (jetstream.KeyWatcher, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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