Documentation
¶
Index ¶
- type InMemoryKeyValueDatabase
- type MockContractConfigTracker
- func (c *MockContractConfigTracker) LatestBlockHeight(ctx context.Context) (uint64, error)
- func (c *MockContractConfigTracker) LatestConfig(ctx context.Context, changedInBlock uint64) (types.ContractConfig, error)
- func (c *MockContractConfigTracker) LatestConfigDetails(ctx context.Context) (uint64, types.ConfigDigest, error)
- func (c *MockContractConfigTracker) Notify() <-chan struct{}
- func (c *MockContractConfigTracker) SetConfig(signers []types.OnchainPublicKey, transmitters []types.Account, f uint8, ...) error
- type StatefulInMemoryKeyValueDatabaseFactory
- func (f *StatefulInMemoryKeyValueDatabaseFactory) ForgetKeyValueDatabaseForTests(configDigest types.ConfigDigest)
- func (f *StatefulInMemoryKeyValueDatabaseFactory) NewKeyValueDatabase(configDigest types.ConfigDigest) (ocr3_1types.KeyValueDatabase, error)
- func (f *StatefulInMemoryKeyValueDatabaseFactory) NewKeyValueDatabaseIfExists(configDigest types.ConfigDigest) (ocr3_1types.KeyValueDatabase, error)
- type StatelessInMemoryKeyValueDatabaseFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryKeyValueDatabase ¶
type InMemoryKeyValueDatabase struct {
// contains filtered or unexported fields
}
func NewInMemoryKeyValueDatabase ¶
func NewInMemoryKeyValueDatabase() *InMemoryKeyValueDatabase
NewInMemoryKeyValueDatabase creates a standalone in-memory database without factory tracking. Use NewStatefulInMemoryKeyValueDatabaseFactory for exclusive access and persistence semantics.
func (*InMemoryKeyValueDatabase) Close ¶
func (db *InMemoryKeyValueDatabase) Close() error
func (*InMemoryKeyValueDatabase) NewReadTransaction ¶
func (db *InMemoryKeyValueDatabase) NewReadTransaction() (ocr3_1types.KeyValueDatabaseReadTransaction, error)
func (*InMemoryKeyValueDatabase) NewReadWriteTransaction ¶
func (db *InMemoryKeyValueDatabase) NewReadWriteTransaction() (ocr3_1types.KeyValueDatabaseReadWriteTransaction, error)
type MockContractConfigTracker ¶
type MockContractConfigTracker struct {
// contains filtered or unexported fields
}
func NewMockContractConfigTracker ¶
func NewMockContractConfigTracker(offchainConfigDigester types.OffchainConfigDigester) *MockContractConfigTracker
NewMockContractConfigTracker returns a tracker that simulates on-chain config history without a chain: LatestBlockHeight is the number of configs set via SetConfig, and LatestConfigDetails returns changedInBlock as the index of the latest config (0 when there are no configs set, 1 when one config is set, etc.) LatestBlockHeight is always +1 to the index/changedInBlock of the latest config.
Requires ContractConfigConfirmations == 1 or SkipContractConfigConfirmations in types.LocalConfig.
Developers must invoke SetConfig at least once to set a meaningful config, otherwise oracles using this tracker will not be able to start.
func (*MockContractConfigTracker) LatestBlockHeight ¶
func (c *MockContractConfigTracker) LatestBlockHeight(ctx context.Context) (uint64, error)
func (*MockContractConfigTracker) LatestConfig ¶
func (c *MockContractConfigTracker) LatestConfig(ctx context.Context, changedInBlock uint64) (types.ContractConfig, error)
func (*MockContractConfigTracker) LatestConfigDetails ¶
func (c *MockContractConfigTracker) LatestConfigDetails(ctx context.Context) (uint64, types.ConfigDigest, error)
func (*MockContractConfigTracker) Notify ¶
func (c *MockContractConfigTracker) Notify() <-chan struct{}
func (*MockContractConfigTracker) SetConfig ¶
func (c *MockContractConfigTracker) SetConfig(signers []types.OnchainPublicKey, transmitters []types.Account, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte) error
SetConfig does not perform *any* validity checks on the supplied config. You are responsible for ensuring that the config is valid for your use case.
type StatefulInMemoryKeyValueDatabaseFactory ¶
type StatefulInMemoryKeyValueDatabaseFactory struct {
// contains filtered or unexported fields
}
StatefulInMemoryKeyValueDatabaseFactory is a factory for testing that retains database contents in memory (not on disk) for the lifetime of the factory. After calling db.Close(), a subsequent NewKeyValueDatabase or NewKeyValueDatabaseIfExists call for the same configDigest returns a database with the contents written before Close. Enforces exclusive access: NewKeyValueDatabase* returns an error if a database for that configDigest has been opened but not yet closed. Use StatefulInMemoryKeyValueDatabaseFactory.ForgetKeyValueDatabaseForTests to make the factory forget about a configDigest (akin to deleting the database from the filesystem for a disk-based implementation).
func NewStatefulInMemoryKeyValueDatabaseFactory ¶
func NewStatefulInMemoryKeyValueDatabaseFactory() *StatefulInMemoryKeyValueDatabaseFactory
func (*StatefulInMemoryKeyValueDatabaseFactory) ForgetKeyValueDatabaseForTests ¶
func (f *StatefulInMemoryKeyValueDatabaseFactory) ForgetKeyValueDatabaseForTests(configDigest types.ConfigDigest)
ForgetKeyValueDatabaseForTests makes the factory forget about a configDigest. The next NewKeyValueDatabase call for this configDigest will create a fresh database; NewKeyValueDatabaseIfExists will return ErrKeyValueDatabaseDoesNotExist. Any currently open database for this configDigest is unaffected and continues to work, but the exclusivity guarantee is lost: the database opened before StatefulInMemoryKeyValueDatabaseFactory.ForgetKeyValueDatabaseForTests and the database opened after can be open simultaneously.
func (*StatefulInMemoryKeyValueDatabaseFactory) NewKeyValueDatabase ¶
func (f *StatefulInMemoryKeyValueDatabaseFactory) NewKeyValueDatabase(configDigest types.ConfigDigest) (ocr3_1types.KeyValueDatabase, error)
func (*StatefulInMemoryKeyValueDatabaseFactory) NewKeyValueDatabaseIfExists ¶
func (f *StatefulInMemoryKeyValueDatabaseFactory) NewKeyValueDatabaseIfExists(configDigest types.ConfigDigest) (ocr3_1types.KeyValueDatabase, error)
type StatelessInMemoryKeyValueDatabaseFactory ¶
type StatelessInMemoryKeyValueDatabaseFactory struct{}
StatelessInMemoryKeyValueDatabaseFactory is a stateless factory for testing. Each call to NewKeyValueDatabase returns a fresh, empty database. NewKeyValueDatabaseIfExists always returns ErrKeyValueDatabaseDoesNotExist. No exclusive access is enforced: multiple concurrent calls to NewKeyValueDatabase with the same configDigest will each succeed and return independent databases. Use StatefulInMemoryKeyValueDatabaseFactory if you need a NewKeyValueDatabase* call to return a database with contents written before a previous Close call.
func NewStatelessInMemoryKeyValueDatabaseFactory ¶
func NewStatelessInMemoryKeyValueDatabaseFactory() StatelessInMemoryKeyValueDatabaseFactory
func (StatelessInMemoryKeyValueDatabaseFactory) NewKeyValueDatabase ¶
func (StatelessInMemoryKeyValueDatabaseFactory) NewKeyValueDatabase(types.ConfigDigest) (ocr3_1types.KeyValueDatabase, error)
func (StatelessInMemoryKeyValueDatabaseFactory) NewKeyValueDatabaseIfExists ¶
func (StatelessInMemoryKeyValueDatabaseFactory) NewKeyValueDatabaseIfExists(types.ConfigDigest) (ocr3_1types.KeyValueDatabase, error)