Documentation ¶
Overview ¶
Package atomic is a generated GoMock package.
Index ¶
- Variables
- func TestPutAndRemoveBatch(t *testing.T, chainID0, _ ids.ID, _, sm1 SharedMemory, db database.Database)
- func TestSharedMemoryCantDuplicatePut(t *testing.T, _, chainID1 ids.ID, sm0, _ SharedMemory, _ database.Database)
- func TestSharedMemoryCantDuplicateRemove(t *testing.T, _, chainID1 ids.ID, sm0, _ SharedMemory, _ database.Database)
- func TestSharedMemoryCommitOnPut(t *testing.T, _, chainID1 ids.ID, sm0, _ SharedMemory, db database.Database)
- func TestSharedMemoryCommitOnRemove(t *testing.T, _, chainID1 ids.ID, sm0, _ SharedMemory, db database.Database)
- func TestSharedMemoryIndexed(t *testing.T, chainID0, chainID1 ids.ID, sm0, sm1 SharedMemory, ...)
- func TestSharedMemoryLargeBatchSize(t *testing.T, _, chainID1 ids.ID, sm0, _ SharedMemory, db database.Database)
- func TestSharedMemoryLargeIndexed(t *testing.T, chainID0, chainID1 ids.ID, sm0, sm1 SharedMemory, ...)
- func TestSharedMemoryLargePutGetAndRemove(t *testing.T, chainID0, chainID1 ids.ID, sm0, sm1 SharedMemory, ...)
- func TestSharedMemoryPutAndGet(t *testing.T, chainID0, chainID1 ids.ID, sm0, sm1 SharedMemory, ...)
- func WriteAll(baseBatch database.Batch, batches ...database.Batch) error
- type Element
- type Memory
- type MockSharedMemory
- func (m *MockSharedMemory) Apply(arg0 map[ids.ID]*Requests, arg1 ...database.Batch) error
- func (m *MockSharedMemory) EXPECT() *MockSharedMemoryMockRecorder
- func (m *MockSharedMemory) Get(arg0 ids.ID, arg1 [][]byte) ([][]byte, error)
- func (m *MockSharedMemory) Indexed(arg0 ids.ID, arg1 [][]byte, arg2, arg3 []byte, arg4 int) ([][]byte, []byte, []byte, error)
- type MockSharedMemoryMockRecorder
- type Requests
- type SharedMemory
Constants ¶
This section is empty.
Variables ¶
TestSharedMemoryPutAndGet, TestSharedMemoryLargePutGetAndRemove, TestSharedMemoryIndexed, TestSharedMemoryLargeIndexed, TestSharedMemoryCantDuplicatePut, TestSharedMemoryCantDuplicateRemove, TestSharedMemoryCommitOnPut, TestSharedMemoryCommitOnRemove, TestSharedMemoryLargeBatchSize, TestPutAndRemoveBatch, }
SharedMemoryTests is a list of all shared memory tests
Functions ¶
func TestPutAndRemoveBatch ¶ added in v1.10.9
func TestPutAndRemoveBatch(t *testing.T, chainID0, _ ids.ID, _, sm1 SharedMemory, db database.Database)
TestPutAndRemoveBatch tests to make sure multiple put and remove requests work properly
func TestSharedMemoryCantDuplicatePut ¶ added in v1.10.9
func TestSharedMemoryCantDuplicateRemove ¶ added in v1.10.9
func TestSharedMemoryCommitOnPut ¶ added in v1.10.9
func TestSharedMemoryCommitOnRemove ¶ added in v1.10.9
func TestSharedMemoryIndexed ¶ added in v1.10.9
func TestSharedMemoryLargeBatchSize ¶ added in v1.10.9
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.10.9
func TestSharedMemoryLargePutGetAndRemove ¶ added in v1.10.9
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.10.9
Types ¶
type Memory ¶ added in v1.10.9
type Memory struct {
// contains filtered or unexported fields
}
Memory is used to set up a bidirectional communication channel between a pair of chains.
For any such pair, we compute a hash of the ordered pair of IDs to use as a prefix DB that can be shared across the two chains. On top of the prefix DB shared among two chains, we use constant prefixes to determine the inbound/outbound and value/index database assignments.
func (*Memory) GetSharedDatabase ¶ added in v1.10.9
GetSharedDatabase returns a new locked prefix db on top of an existing database
Invariant: ReleaseSharedDatabase must be called after to free the database associated with [sharedID]
func (*Memory) NewSharedMemory ¶ added in v1.10.9
func (m *Memory) NewSharedMemory(chainID ids.ID) SharedMemory
func (*Memory) ReleaseSharedDatabase ¶ added in v1.10.9
ReleaseSharedDatabase unlocks the provided DB
Note: ReleaseSharedDatabase must be called only after a corresponding call to GetSharedDatabase. If ReleaseSharedDatabase is called without a corresponding one-to-one call with GetSharedDatabase, it will panic.
type MockSharedMemory ¶ added in v1.10.9
type MockSharedMemory struct {
// contains filtered or unexported fields
}
MockSharedMemory is a mock of SharedMemory interface.
func NewMockSharedMemory ¶ added in v1.10.9
func NewMockSharedMemory(ctrl *gomock.Controller) *MockSharedMemory
NewMockSharedMemory creates a new mock instance.
func (*MockSharedMemory) EXPECT ¶ added in v1.10.9
func (m *MockSharedMemory) EXPECT() *MockSharedMemoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockSharedMemoryMockRecorder ¶ added in v1.10.9
type MockSharedMemoryMockRecorder struct {
// contains filtered or unexported fields
}
MockSharedMemoryMockRecorder is the mock recorder for MockSharedMemory.
func (*MockSharedMemoryMockRecorder) Apply ¶ added in v1.10.9
func (mr *MockSharedMemoryMockRecorder) Apply(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Apply indicates an expected call of Apply.
func (*MockSharedMemoryMockRecorder) Get ¶ added in v1.10.9
func (mr *MockSharedMemoryMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call
Get indicates an expected call of Get.
func (*MockSharedMemoryMockRecorder) Indexed ¶ added in v1.10.9
func (mr *MockSharedMemoryMockRecorder) Indexed(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call
Indexed indicates an expected call of Indexed.
type SharedMemory ¶
type SharedMemory interface { // [peerChainID] // // Invariant: Get guarantees that the resulting values array is the same // length as keys. Get(peerChainID ids.ID, keys [][]byte) (values [][]byte, err error) // given traits and were sent from [peerChainID]. Indexed( peerChainID ids.ID, traits [][]byte, startTrait, startKey []byte, limit int, ) ( values [][]byte, lastTrait, lastKey []byte, err error, ) // [requests] to their respective chainID keys in the map along with the // batches on the underlying DB. // // Invariant: The underlying database of [batches] must be the same as the // underlying database for SharedMemory. Apply(requests map[ids.ID]*Requests, batches ...database.Batch) error }