internal

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressBytesOrZero

func AddressBytesOrZero(addr swarm.Address) []byte

AddressBytesOrZero is a helper which creates a zero buffer of swarm.HashSize. This is required during storing the items in the Store as their serialization formats are strict.

func AddressOrZero

func AddressOrZero(buf []byte) swarm.Address

AddressOrZero returns swarm.ZeroAddress if the buf is of zero bytes. The Zero byte buffer is used by the items to serialize their contents and if valid swarm.ZeroAddress entries are allowed.

Types

type BatchedStorage

type BatchedStorage interface {
	Storage
	TxExecutor
}

BatchedStorage groups the Storage and TxExecutor interfaces.

func NewInmemStorage

func NewInmemStorage() (BatchedStorage, func() error)

NewInmemStorage constructs a inmem Storage implementation which can be used for the tests in the internal packages.

type PutterCloserWithReference

type PutterCloserWithReference interface {
	Put(context.Context, Storage, storage.Writer, swarm.Chunk) error
	Close(Storage, storage.Writer, swarm.Address) error
	Cleanup(TxExecutor) error
}

PutterCloserWithReference provides a Putter which can be closed with a root swarm reference associated with this session.

type Storage

type Storage interface {
	IndexStore() storage.BatchedStore
	ChunkStore() storage.ChunkStore
}

Storage groups the storage.Store and storage.ChunkStore interfaces.

type TxExecutor

type TxExecutor interface {
	Execute(context.Context, func(Storage) error) error
}

TxExecutor executes a function in a transaction.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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