1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-09 09:20:45 +00:00
v2fly/features/extension/storage/storage.go

26 lines
859 B
Go
Raw Normal View History

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)
2022-01-30 19:53:11 +00:00
Clear(ctx context.Context)
NarrowScope(ctx context.Context, key []byte) (ScopedPersistentStorage, error)
2022-01-30 19:53:11 +00:00
DropScope(ctx context.Context, key []byte) error
}
type ScopedTransientStorage interface {
ScopedTransientStorage()
2022-01-30 19:53:11 +00:00
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)
2022-01-30 19:53:11 +00:00
NarrowScope(ctx context.Context, key string) (ScopedPersistentStorage, error)
DropScope(ctx context.Context, key string) error
}