atomic

package
v1.4.8-rc.5 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: BSD-3-Clause Imports: 16 Imported by: 60

Documentation

Index

Constants

This section is empty.

Variables

SharedMemoryTests is a list of all shared memory tests

Functions

func TestSharedMemoryCantDuplicatePut added in v1.4.0

func TestSharedMemoryCantDuplicatePut(t *testing.T, _, chainID1 ids.ID, sm0, _ SharedMemory, _ database.Database)

func TestSharedMemoryCantDuplicateRemove added in v1.4.0

func TestSharedMemoryCantDuplicateRemove(t *testing.T, _, chainID1 ids.ID, sm0, _ SharedMemory, _ database.Database)

func TestSharedMemoryCommitOnPut added in v1.4.0

func TestSharedMemoryCommitOnPut(t *testing.T, _, chainID1 ids.ID, sm0, _ SharedMemory, db database.Database)

func TestSharedMemoryCommitOnRemove added in v1.4.0

func TestSharedMemoryCommitOnRemove(t *testing.T, _, chainID1 ids.ID, sm0, _ SharedMemory, db database.Database)

func TestSharedMemoryIndexed added in v1.4.0

func TestSharedMemoryIndexed(t *testing.T, chainID0, chainID1 ids.ID, sm0, sm1 SharedMemory, _ database.Database)

func TestSharedMemoryLargeBatchSize added in v1.4.0

func TestSharedMemoryLargeBatchSize(t *testing.T, _, chainID1 ids.ID, sm0, _ SharedMemory, db database.Database)

TestSharedMemoryLargeBatchSize tests to make sure that the interface can support large batches.

func TestSharedMemoryLargeIndexed added in v1.4.0

func TestSharedMemoryLargeIndexed(t *testing.T, chainID0, chainID1 ids.ID, sm0, sm1 SharedMemory, _ database.Database)

func TestSharedMemoryLargePutGetAndRemove added in v1.4.0

func TestSharedMemoryLargePutGetAndRemove(t *testing.T, chainID0, chainID1 ids.ID, sm0, sm1 SharedMemory, _ database.Database)

TestSharedMemoryLargePutGetAndRemove tests to make sure that the interface can support large values.

func TestSharedMemoryPutAndGet added in v1.4.0

func TestSharedMemoryPutAndGet(t *testing.T, chainID0, chainID1 ids.ID, sm0, sm1 SharedMemory, _ database.Database)

func WriteAll

func WriteAll(baseBatch database.Batch, batches ...database.Batch) error

WriteAll assumes all batches have the same underlying database. Batches should not be modified after being passed to this function.

Types

type Element added in v0.8.0

type Element struct {
	Key    []byte
	Value  []byte
	Traits [][]byte
}

Element ...

type Memory added in v0.8.0

type Memory struct {
	// contains filtered or unexported fields
}

Memory is the interface for shared memory inside a subnet

func (*Memory) GetDatabase added in v0.8.0

func (m *Memory) GetDatabase(sharedID ids.ID) (*versiondb.Database, database.Database)

GetDatabase returns and locks the provided DB

func (*Memory) Initialize added in v0.8.0

func (m *Memory) Initialize(log logging.Logger, db database.Database) error

Initialize the SharedMemory

func (*Memory) NewSharedMemory added in v0.8.0

func (m *Memory) NewSharedMemory(id ids.ID) SharedMemory

NewSharedMemory returns a new SharedMemory

func (*Memory) ReleaseDatabase added in v0.8.0

func (m *Memory) ReleaseDatabase(sharedID ids.ID)

ReleaseDatabase unlocks the provided DB

type SharedMemory

type SharedMemory interface {
	// Adds to the peer chain's side
	Put(peerChainID ids.ID, elems []*Element, batches ...database.Batch) error

	// Fetches from this chain's side
	Get(peerChainID ids.ID, keys [][]byte) (values [][]byte, err error)
	Indexed(
		peerChainID ids.ID,
		traits [][]byte,
		startTrait,
		startKey []byte,
		limit int,
	) (
		values [][]byte,
		lastTrait,
		lastKey []byte,
		err error,
	)
	Remove(peerChainID ids.ID, keys [][]byte, batches ...database.Batch) error
}

SharedMemory ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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