nats

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 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 added in v0.10.1

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 added in v0.11.0

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

func (*Backend) Close added in v0.11.0

func (b *Backend) Close() error

func (*Backend) Count added in v0.11.0

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

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

func (*Backend) Create added in v0.11.0

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) CurrentRevision added in v0.11.2

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

CurrentRevision returns the current revision of the database.

func (*Backend) DbSize added in v0.11.0

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

DbSize get the kineBucket size from JetStream.

func (*Backend) Delete added in v0.11.0

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

func (*Backend) Get added in v0.11.0

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 added in v0.11.0

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 added in v0.11.0

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

func (*Backend) Watch added in v0.11.0

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

type BackendLogger added in v0.11.0

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

func (*BackendLogger) Count added in v0.11.0

func (b *BackendLogger) Count(ctx context.Context, prefix string, revision int64) (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 added in v0.11.0

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) CurrentRevision added in v0.11.2

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

CurrentRevision returns the current revision of the database.

func (*BackendLogger) DbSize added in v0.11.0

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

DbSize get the kineBucket size from JetStream.

func (*BackendLogger) Delete added in v0.11.0

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

func (*BackendLogger) Get added in v0.11.0

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 added in v0.11.0

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

func (*BackendLogger) Start added in v0.11.0

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

func (*BackendLogger) Update added in v0.11.0

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 added in v0.11.0

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 added in v0.11.0

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

func NewKeyValue added in v0.11.0

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

func (*KeyValue) BucketRevision added in v0.11.0

func (e *KeyValue) BucketRevision() int64

BucketRevision returns the latest revision of the bucket.

func (*KeyValue) BucketSize added in v0.11.0

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

BucketSize returns the size of the bucket in bytes.

func (*KeyValue) Count added in v0.11.0

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

func (*KeyValue) Create added in v0.11.0

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

func (*KeyValue) Delete added in v0.11.0

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

func (*KeyValue) Get added in v0.11.0

func (*KeyValue) GetRevision added in v0.11.0

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

func (*KeyValue) List added in v0.11.0

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

func (*KeyValue) Update added in v0.11.0

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

func (*KeyValue) Watch added in v0.11.0

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