1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

move scoped storage to independent package

This commit is contained in:
Shelikhoo 2021-09-05 15:36:17 +01:00
parent 908dd96f1f
commit 6a4364f37a
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
2 changed files with 25 additions and 20 deletions

View File

@ -13,23 +13,3 @@ type PersistentStorageEngine interface {
Get(ctx context.Context, key []byte) ([]byte, error)
List(ctx context.Context, keyPrefix []byte) ([][]byte, error)
}
type ScopedPersistentStorage interface {
ScopedPersistentStorageEngine()
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
NarrowScope(ctx context.Context, key []byte) (ScopedPersistentStorage, 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)
Clear(ctx context.Context)
NarrowScope(ctx context.Context, key []byte) (ScopedPersistentStorage, error)
}

View File

@ -0,0 +1,25 @@
package storage
import (
"context"
)
type ScopedPersistentStorage interface {
ScopedPersistentStorageEngine()
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
NarrowScope(ctx context.Context, key []byte) (ScopedPersistentStorage, 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)
Clear(ctx context.Context)
NarrowScope(ctx context.Context, key []byte) (ScopedPersistentStorage, error)
}