Documentation
¶
Overview ¶
Package datastore is a generated GoMock package.
Index ¶
- Variables
- type BlobStore
- func (bs *BlobStore) GetBlobSizes(hint Hint, ids [][]byte) (sizes []int, err error)
- func (bs *BlobStore) Has(hint Hint, key []byte) (bool, error)
- func (bs *BlobStore) LoadBlob(ctx context.Context, hint Hint, key []byte, blob *sql.Blob) error
- func (bs *BlobStore) SetMalfeasanceProvider(p MalfeasanceProvider)
- type CachedDB
- func (db *CachedDB) CacheMalfeasanceProof(id types.NodeID, proof []byte)
- func (db *CachedDB) GetAtx(id types.ATXID) (*types.ActivationTx, error)
- func (db *CachedDB) IterateMalfeasanceProofs(iter func(types.NodeID, []byte) error) error
- func (db *CachedDB) MalfeasanceProof(id types.NodeID) ([]byte, error)
- func (db *CachedDB) MaxHeightAtx() (types.ATXID, error)
- func (db *CachedDB) Previous(id types.ATXID) ([]types.ATXID, error)
- func (db *CachedDB) VRFNonce(id types.NodeID, epoch types.EpochID) (types.VRFPostIndex, error)
- type Config
- type Hint
- type MalfeasanceProvider
- type MockMalfeasanceProvider
- type MockMalfeasanceProviderMockRecorder
- type MockMalfeasanceProviderProofByIDCall
- func (c *MockMalfeasanceProviderProofByIDCall) Do(f func(context.Context, types.NodeID) ([]byte, error)) *MockMalfeasanceProviderProofByIDCall
- func (c *MockMalfeasanceProviderProofByIDCall) DoAndReturn(f func(context.Context, types.NodeID) ([]byte, error)) *MockMalfeasanceProviderProofByIDCall
- func (c *MockMalfeasanceProviderProofByIDCall) Return(arg0 []byte, arg1 error) *MockMalfeasanceProviderProofByIDCall
- type Opt
- type VrfNonceKey
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type BlobStore ¶
type BlobStore struct { DB sql.StateDatabase // contains filtered or unexported fields }
BlobStore gets data as a blob to serve direct fetch requests.
func NewBlobStore ¶
func NewBlobStore(db sql.StateDatabase, proposals *store.Store) *BlobStore
NewBlobStore returns a BlobStore.
func (*BlobStore) GetBlobSizes ¶ added in v1.4.1
GetBlobSizes returns the sizes of the blobs corresponding to the specified ids. For non-existent objects, the corresponding items are set to -1.
func (*BlobStore) LoadBlob ¶ added in v1.4.1
LoadBlob gets an blob as bytes by an object ID as bytes.
func (*BlobStore) SetMalfeasanceProvider ¶ added in v1.7.13
func (bs *BlobStore) SetMalfeasanceProvider(p MalfeasanceProvider)
SetMalfeasanceProvider sets the malfeasance provider dependency.
TODO(mafa): this is a hack because of a cyclic dependency between the packages
malfeasance2 -> fetcher -> datastore -> malfeasance2
type CachedDB ¶
CachedDB is simply a database injected with cache.
func NewCachedDB ¶
NewCachedDB create an instance of a CachedDB.
func (*CachedDB) CacheMalfeasanceProof ¶
CacheMalfeasanceProof caches the malfeasance proof for the given node ID. This function is thread safe. Deprecated: caching is done by the sql database automatically.
func (*CachedDB) GetAtx ¶ added in v1.6.0
GetAtx returns the ATX by the given ID. This function is thread safe and will return an error if the ID is not found in the ATX DB.
func (*CachedDB) IterateMalfeasanceProofs ¶ added in v1.1.0
IterateMalfeasanceProofs iterates over all malfeasance proofs in the database and calls the provided callback on each. Deprecated: replaced by identities.IterateOps and malfeasance.IterateOps.
func (*CachedDB) MalfeasanceProof ¶ added in v1.7.0
MalfeasanceProof returns the malfeasance proof for the given node ID. This function is thread safe and will return an error if the proof is not found in the ATX DB. Deprecated: use functions in the `sql/identities` and `sql/malfeasance` packages.
func (*CachedDB) MaxHeightAtx ¶
MaxHeightAtx returns the ATX ID with the maximum height. Deprecated: replaced by atxs.GetIDWithMaxHeight.
type Config ¶ added in v1.1.2
type Config struct { // ATXSize must be larger than the sum of all ATXs in last 2 epochs to be effective ATXSize int `mapstructure:"atx-size"` MalfeasanceSize int `mapstructure:"malfeasance-size"` }
func DefaultConfig ¶ added in v1.1.2
func DefaultConfig() Config
type MalfeasanceProvider ¶ added in v1.7.13
type MockMalfeasanceProvider ¶ added in v1.7.13
type MockMalfeasanceProvider struct {
// contains filtered or unexported fields
}
MockMalfeasanceProvider is a mock of MalfeasanceProvider interface.
func NewMockMalfeasanceProvider ¶ added in v1.7.13
func NewMockMalfeasanceProvider(ctrl *gomock.Controller) *MockMalfeasanceProvider
NewMockMalfeasanceProvider creates a new mock instance.
func (*MockMalfeasanceProvider) EXPECT ¶ added in v1.7.13
func (m *MockMalfeasanceProvider) EXPECT() *MockMalfeasanceProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockMalfeasanceProviderMockRecorder ¶ added in v1.7.13
type MockMalfeasanceProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockMalfeasanceProviderMockRecorder is the mock recorder for MockMalfeasanceProvider.
func (*MockMalfeasanceProviderMockRecorder) ProofByID ¶ added in v1.7.13
func (mr *MockMalfeasanceProviderMockRecorder) ProofByID(ctx, nodeID any) *MockMalfeasanceProviderProofByIDCall
ProofByID indicates an expected call of ProofByID.
type MockMalfeasanceProviderProofByIDCall ¶ added in v1.7.13
MockMalfeasanceProviderProofByIDCall wrap *gomock.Call
func (*MockMalfeasanceProviderProofByIDCall) Do ¶ added in v1.7.13
func (c *MockMalfeasanceProviderProofByIDCall) Do(f func(context.Context, types.NodeID) ([]byte, error)) *MockMalfeasanceProviderProofByIDCall
Do rewrite *gomock.Call.Do
func (*MockMalfeasanceProviderProofByIDCall) DoAndReturn ¶ added in v1.7.13
func (c *MockMalfeasanceProviderProofByIDCall) DoAndReturn(f func(context.Context, types.NodeID) ([]byte, error)) *MockMalfeasanceProviderProofByIDCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockMalfeasanceProviderProofByIDCall) Return ¶ added in v1.7.13
func (c *MockMalfeasanceProviderProofByIDCall) Return(arg0 []byte, arg1 error) *MockMalfeasanceProviderProofByIDCall
Return rewrite *gomock.Call.Return
type Opt ¶ added in v1.1.2
type Opt func(*cacheOpts)