Documentation ¶
Index ¶
- func RegisterID(owner []byte, key []byte) flow.RegisterID
- type EphemeralStorage
- func (s *EphemeralStorage) AllocateSlabIndex(owner []byte) (atree.SlabIndex, error)
- func (s *EphemeralStorage) GetValue(owner []byte, key []byte) ([]byte, error)
- func (s *EphemeralStorage) SetValue(owner, key, value []byte) error
- func (s *EphemeralStorage) StorageRegisterUpdates() map[flow.RegisterID]flow.RegisterValue
- func (s *EphemeralStorage) ValueExists(owner []byte, key []byte) (bool, error)
- type ReadOnlyStorage
- func (s *ReadOnlyStorage) AllocateSlabIndex(owner []byte) (atree.SlabIndex, error)
- func (s *ReadOnlyStorage) GetValue(owner []byte, key []byte) ([]byte, error)
- func (s *ReadOnlyStorage) SetValue(owner, key, value []byte) error
- func (s *ReadOnlyStorage) ValueExists(owner []byte, key []byte) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterID ¶
func RegisterID(owner []byte, key []byte) flow.RegisterID
RegisterID creates a RegisterID from owner and key
Types ¶
type EphemeralStorage ¶
type EphemeralStorage struct {
// contains filtered or unexported fields
}
EphemeralStorage holds on to register changes instead of applying them directly to the provided backend storage. It can be used for dry running transaction/calls or batching updates for atomic operations.
func NewEphemeralStorage ¶
func NewEphemeralStorage(parent types.BackendStorage) *EphemeralStorage
NewEphemeralStorage constructs a new EphemeralStorage
func (*EphemeralStorage) AllocateSlabIndex ¶
func (s *EphemeralStorage) AllocateSlabIndex(owner []byte) (atree.SlabIndex, error)
AllocateSlabIndex allocates an slab index based on the given owner
func (*EphemeralStorage) GetValue ¶
func (s *EphemeralStorage) GetValue(owner []byte, key []byte) ([]byte, error)
GetValue reads a register value
func (*EphemeralStorage) SetValue ¶
func (s *EphemeralStorage) SetValue(owner, key, value []byte) error
SetValue sets a register value
func (*EphemeralStorage) StorageRegisterUpdates ¶
func (s *EphemeralStorage) StorageRegisterUpdates() map[flow.RegisterID]flow.RegisterValue
StorageRegisterUpdates returns a map of register updates
func (*EphemeralStorage) ValueExists ¶
func (s *EphemeralStorage) ValueExists(owner []byte, key []byte) (bool, error)
ValueExists checks if a register exists
type ReadOnlyStorage ¶
type ReadOnlyStorage struct {
// contains filtered or unexported fields
}
ReadOnlyStorage wraps an snapshot and only provides read functionality.
func NewReadOnlyStorage ¶
func NewReadOnlyStorage(snapshot types.BackendStorageSnapshot) *ReadOnlyStorage
NewReadOnlyStorage constructs a new ReadOnlyStorage using the given snapshot
func (*ReadOnlyStorage) AllocateSlabIndex ¶
func (s *ReadOnlyStorage) AllocateSlabIndex(owner []byte) (atree.SlabIndex, error)
AllocateSlabIndex returns an error if called
func (*ReadOnlyStorage) GetValue ¶
func (s *ReadOnlyStorage) GetValue(owner []byte, key []byte) ([]byte, error)
GetValue reads a register value
func (*ReadOnlyStorage) SetValue ¶
func (s *ReadOnlyStorage) SetValue(owner, key, value []byte) error
SetValue returns an error if called
func (*ReadOnlyStorage) ValueExists ¶
func (s *ReadOnlyStorage) ValueExists(owner []byte, key []byte) (bool, error)
ValueExists checks if a register exists