storage.go 858 B

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