From 0bfc2d1cd4f9cf858c883e53b0bef14b3dc1821a Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Sun, 30 Jan 2022 19:53:11 +0000 Subject: [PATCH] rewrite scoped storage interface --- features/extension/storage/storage.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/features/extension/storage/storage.go b/features/extension/storage/storage.go index d53cdb86f..4ed58671a 100644 --- a/features/extension/storage/storage.go +++ b/features/extension/storage/storage.go @@ -9,15 +9,17 @@ type ScopedPersistentStorage interface { Put(ctx context.Context, key []byte, value []byte) error Get(ctx context.Context, key []byte) ([]byte, error) List(ctx context.Context, keyPrefix []byte) ([][]byte, error) - ClearIfCharacteristicMismatch(ctx context.Context, characteristic []byte) error + Clear(ctx context.Context) NarrowScope(ctx context.Context, key []byte) (ScopedPersistentStorage, error) + DropScope(ctx context.Context, key []byte) error } type ScopedTransientStorage interface { ScopedTransientStorage() - Put(ctx context.Context, key []byte, value interface{}) error - Get(ctx context.Context, key []byte) (interface{}, error) - List(ctx context.Context, keyPrefix []byte) ([][]byte, error) + Put(ctx context.Context, key string, value interface{}) error + Get(ctx context.Context, key string) (interface{}, error) + List(ctx context.Context, keyPrefix string) ([]string, error) Clear(ctx context.Context) - NarrowScope(ctx context.Context, key []byte) (ScopedPersistentStorage, error) + NarrowScope(ctx context.Context, key string) (ScopedPersistentStorage, error) + DropScope(ctx context.Context, key string) error }