Skip to content

Commit

Permalink
CBG-3921 consolidate error handling function to IsDocNotFoundError
Browse files Browse the repository at this point in the history
  • Loading branch information
torcolvin committed May 15, 2024
1 parent c2aa515 commit 65113dc
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ const (
BucketStoreFeatureMultiXattrSubdocOperations
)

// DataStoreErrorType can be tested with DataStore.IsError
type DataStoreErrorType int

const (
KeyNotFoundError = DataStoreErrorType(iota)
)

// BucketStore is a basic interface that describes a bucket - with one or many underlying DataStore.
type BucketStore interface {
GetName() string // The bucket's name
Expand All @@ -62,7 +55,6 @@ type BucketStore interface {
NamedDataStore(DataStoreName) (DataStore, error)

MutationFeedStore
TypedErrorStore
BucketStoreFeatureIsSupported
}

Expand All @@ -82,11 +74,6 @@ type MutationFeedStore interface {
StartDCPFeed(ctx context.Context, args FeedArguments, callback FeedEventCallbackFunc, dbStats *expvar.Map) error
}

// TypedErrorStore can introspect the errors it returns.
type TypedErrorStore interface {
IsError(err error, errorType DataStoreErrorType) bool
}

// BucketStoreFeatureIsSupported allows a BucketStore to be tested for support for various features.
type BucketStoreFeatureIsSupported interface {
IsSupported(feature BucketStoreFeature) bool // IsSupported reports whether the bucket/datastore supports a given feature
Expand All @@ -106,7 +93,6 @@ type DataStore interface {
KVStore
XattrStore
SubdocStore
TypedErrorStore
BucketStoreFeatureIsSupported
DataStoreName
}
Expand Down Expand Up @@ -162,7 +148,7 @@ type KVStore interface {
// If the document is a tombstone, nothing is stored.
// Return values:
// - cas: The document's current CAS (sequence) number.
// - err: Error, if any. MissingError if the key does not exist.
// - err: Error, if any. Returns an error if the key does not exist.
Get(k string, rv interface{}) (cas uint64, err error)

// GetRaw returns value of a key as a raw byte array.
Expand All @@ -171,7 +157,7 @@ type KVStore interface {
// Return values:
// - rv: The raw value. Nil if the document is a tombstone.
// - cas: The document's current CAS (sequence) number.
// - err: Error, if any. MissingError if the key does not exist.
// - err: Error, if any. Returns an error if the key does not exist.
GetRaw(k string) (rv []byte, cas uint64, err error)

// GetAndTouchRaw is like GetRaw, but also sets the document's expiration time.
Expand Down Expand Up @@ -238,12 +224,12 @@ type KVStore interface {

// Delete removes a document by setting its value to nil, making it a tombstone.
// System xattrs are preserved but user xattrs are removed.
// Returns MissingError if the document doesn't exist or has no value.
// Returns an error if the document doesn't exist or has no value.
Delete(k string) error

// Remove a document if its CAS matches the given value.
// System xattrs are preserved but user xattrs are removed.
// Returns MissingError if the document doesn't exist or has no value. Returns a CasMismatchErr if the CAS doesn't match.
// Returns an erorr if the document doesn't exist or has no value. Returns a CasMismatchErr if the CAS doesn't match.
Remove(k string, cas uint64) (casOut uint64, err error)

// Update interactively updates a document. The document's current value (nil if none) is passed to
Expand Down

0 comments on commit 65113dc

Please sign in to comment.