github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/features/extension/storage/storage.go (about)

     1  package storage
     2  
     3  import (
     4  	"context"
     5  )
     6  
     7  type ScopedPersistentStorage interface {
     8  	ScopedPersistentStorageEngine()
     9  	Put(ctx context.Context, key []byte, value []byte) error
    10  	Get(ctx context.Context, key []byte) ([]byte, error)
    11  	List(ctx context.Context, keyPrefix []byte) ([][]byte, error)
    12  	Clear(ctx context.Context)
    13  	NarrowScope(ctx context.Context, key []byte) (ScopedPersistentStorage, error)
    14  	DropScope(ctx context.Context, key []byte) error
    15  }
    16  
    17  type ScopedTransientStorage interface {
    18  	ScopedTransientStorage()
    19  	Put(ctx context.Context, key string, value interface{}) error
    20  	Get(ctx context.Context, key string) (interface{}, error)
    21  	List(ctx context.Context, keyPrefix string) ([]string, error)
    22  	Clear(ctx context.Context)
    23  	NarrowScope(ctx context.Context, key string) (ScopedTransientStorage, error)
    24  	DropScope(ctx context.Context, key string) error
    25  }