storage.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. package storage
  2. import (
  3. "context"
  4. "github.com/v2fly/v2ray-core/v5/features"
  5. )
  6. type ScopedPersistentStorage interface {
  7. ScopedPersistentStorageEngine()
  8. Put(ctx context.Context, key []byte, value []byte) error
  9. Get(ctx context.Context, key []byte) ([]byte, error)
  10. List(ctx context.Context, keyPrefix []byte) ([][]byte, error)
  11. Clear(ctx context.Context)
  12. NarrowScope(ctx context.Context, key []byte) (ScopedPersistentStorage, error)
  13. DropScope(ctx context.Context, key []byte) error
  14. }
  15. type ScopedTransientStorage interface {
  16. ScopedTransientStorage()
  17. Put(ctx context.Context, key string, value interface{}) error
  18. Get(ctx context.Context, key string) (interface{}, error)
  19. List(ctx context.Context, keyPrefix string) ([]string, error)
  20. Clear(ctx context.Context)
  21. NarrowScope(ctx context.Context, key string) (ScopedTransientStorage, error)
  22. DropScope(ctx context.Context, key string) error
  23. }
  24. type ScopedPersistentStorageService interface {
  25. ScopedPersistentStorage
  26. features.Feature
  27. }
  28. var ScopedPersistentStorageServiceType = (*ScopedPersistentStorageService)(nil)