forked from v2fly/v2ray-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstorage.go
25 lines (22 loc) · 858 Bytes
/
storage.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
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 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 string) (ScopedTransientStorage, error)
DropScope(ctx context.Context, key string) error
}