storage

package
v0.38.0-preview.0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL