storage

package
v0.44.6 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: AGPL-3.0 Imports: 5 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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