diff --git a/storage/kv/bucket.go b/storage/kv/bucket.go index 8841fa9..7a1214e 100644 --- a/storage/kv/bucket.go +++ b/storage/kv/bucket.go @@ -28,8 +28,11 @@ type RWBucket interface { Delete(ctx context.Context, key string) error } -// Bucket defines simple read-write operations for key-value stores. -type Bucket interface { +// CRUDBucket defines simple read-write operations for key-value stores. +type CRUDBucket interface { ROBucket RWBucket } + +// Bucket is an alias for any commonly used key-value store. +type Bucket = CRUDBucket diff --git a/storage/kv/keys.go b/storage/kv/keys.go index 5d746aa..888b802 100644 --- a/storage/kv/keys.go +++ b/storage/kv/keys.go @@ -22,14 +22,14 @@ type KeysPrefixTraverser interface { // KeysTraversingBucket is a key-value store that can traverse keys. type KeysTraversingBucket interface { - Bucket + CRUDBucket KeysTraverser } // KeysPrefixTraversingBucket is a key-value store that can traverse keys. // Inlcuding using a prefix. type KeysPrefixTraversingBucket interface { - Bucket + CRUDBucket KeysTraverser KeysPrefixTraverser } diff --git a/storage/kv/test/bucket.go b/storage/kv/test/bucket.go index 4ca7e7a..a03aec1 100644 --- a/storage/kv/test/bucket.go +++ b/storage/kv/test/bucket.go @@ -9,7 +9,7 @@ import ( "github.com/micromdm/nanolib/storage/kv" ) -func TestBucketSimple(t *testing.T, ctx context.Context, b kv.Bucket) { +func TestBucketSimple(t *testing.T, ctx context.Context, b kv.CRUDBucket) { const testKey1 = "test_key_1" const testKey2 = "test_key_2" const testValue1 = "test_value_1"