From d3a9d66e655c844e19441e52fd5584eca3655793 Mon Sep 17 00:00:00 2001 From: Jesse Peterson Date: Tue, 3 Sep 2024 23:54:26 -0700 Subject: [PATCH] rename unadorned bucket to crudbucket --- storage/kv/bucket.go | 7 +++++-- storage/kv/keys.go | 4 ++-- storage/kv/test/bucket.go | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) 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"