Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADDED] KV implementation in new JetStream API #1362

Merged
merged 4 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ issues:
- linters:
- errcheck
text: "msg.Ack"
- linters:
- errcheck
text: "watcher.Stop"
34 changes: 34 additions & 0 deletions jetstream/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const (
JSErrCodeMessageNotFound ErrorCode = 10037

JSErrCodeBadRequest ErrorCode = 10003

JSErrCodeStreamWrongLastSequence ErrorCode = 10071
)

var (
Expand Down Expand Up @@ -178,6 +180,38 @@ var (
// ErrOrderedConsumerNotCreated is returned when trying to get consumer info of an
// ordered consumer which was not yet created.
ErrOrderedConsumerNotCreated = &jsError{message: "consumer instance not yet created"}

// KeyValue Errors

// ErrKeyExists is returned when attempting to create a key that already exists.
ErrKeyExists JetStreamError = &jsError{apiErr: &APIError{ErrorCode: JSErrCodeStreamWrongLastSequence, Code: 400}, message: "key exists"}

// ErrKeyValueConfigRequired is returned when attempting to create a bucket without a config.
ErrKeyValueConfigRequired = &jsError{message: "config required"}

// ErrInvalidBucketName is returned when attempting to create a bucket with an invalid name.
ErrInvalidBucketName = &jsError{message: "invalid bucket name"}

// ErrInvalidKey is returned when attempting to create a key with an invalid name.
ErrInvalidKey = &jsError{message: "invalid key"}

// ErrBucketNotFound is returned when attempting to access a bucket that does not exist.
ErrBucketNotFound = &jsError{message: "bucket not found"}

// ErrBadBucket is returned when attempting to access a bucket that is not a key-value store.
ErrBadBucket = &jsError{message: "bucket not valid key-value store"}

// ErrKeyNotFound is returned when attempting to access a key that does not exist.
ErrKeyNotFound = &jsError{message: "key not found"}

// ErrKeyDeleted is returned when attempting to access a key that was deleted.
ErrKeyDeleted = &jsError{message: "key was deleted"}

// ErrHistoryToLarge is returned when provided history limit is larger than 64.
ErrHistoryTooLarge = &jsError{message: "history limited to a max of 64"}

// ErrNoKeysFound is returned when no keys are found.
ErrNoKeysFound = &jsError{message: "no keys found"}
)

// Error prints the JetStream API error code and description
Expand Down
1 change: 1 addition & 0 deletions jetstream/jetstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type (
StreamConsumerManager
StreamManager
Publisher
KeyValueManager
}

Publisher interface {
Expand Down
Loading