Documentation ¶
Index ¶
- func GetFromCacheOrCall[Value any](cache KVStore, volatile bool, key CacheKey, valueFunc func() (*Value, error)) (*Value, error)
- func GetSliceFromCacheOrCall[Response any](cache KVStore, volatile bool, key CacheKey, ...) ([]Response, error)
- type CacheKey
- type FileConsensusApiLite
- func (c *FileConsensusApiLite) Close() error
- func (c *FileConsensusApiLite) GetBlock(ctx context.Context, height int64) (*consensus.Block, error)
- func (c *FileConsensusApiLite) GetCommittees(ctx context.Context, height int64, runtimeID coreCommon.Namespace) ([]nodeapi.Committee, error)
- func (c *FileConsensusApiLite) GetEpoch(ctx context.Context, height int64) (beacon.EpochTime, error)
- func (c *FileConsensusApiLite) GetGenesisDocument(ctx context.Context, chainContext string) (*genesis.Document, error)
- func (c *FileConsensusApiLite) GetProposal(ctx context.Context, height int64, proposalID uint64) (*nodeapi.Proposal, error)
- func (c *FileConsensusApiLite) GetTransactionsWithResults(ctx context.Context, height int64) ([]nodeapi.TransactionWithResults, error)
- func (c *FileConsensusApiLite) GetValidators(ctx context.Context, height int64) ([]nodeapi.Validator, error)
- func (c *FileConsensusApiLite) GovernanceEvents(ctx context.Context, height int64) ([]nodeapi.Event, error)
- func (c *FileConsensusApiLite) RegistryEvents(ctx context.Context, height int64) ([]nodeapi.Event, error)
- func (c *FileConsensusApiLite) RoothashEvents(ctx context.Context, height int64) ([]nodeapi.Event, error)
- func (c *FileConsensusApiLite) StakingEvents(ctx context.Context, height int64) ([]nodeapi.Event, error)
- func (c *FileConsensusApiLite) StateToGenesis(ctx context.Context, height int64) (*genesis.Document, error)
- type FileRuntimeApiLite
- func (r *FileRuntimeApiLite) Close() error
- func (r *FileRuntimeApiLite) EVMGetCode(ctx context.Context, round uint64, address []byte) ([]byte, error)
- func (r *FileRuntimeApiLite) EVMSimulateCall(ctx context.Context, round uint64, gasPrice []byte, gasLimit uint64, ...) (*nodeapi.FallibleResponse, error)
- func (r *FileRuntimeApiLite) GetBlockHeader(ctx context.Context, round uint64) (*nodeapi.RuntimeBlockHeader, error)
- func (r *FileRuntimeApiLite) GetEventsRaw(ctx context.Context, round uint64) ([]nodeapi.RuntimeEvent, error)
- func (r *FileRuntimeApiLite) GetNativeBalance(ctx context.Context, round uint64, addr nodeapi.Address) (*common.BigInt, error)
- func (r *FileRuntimeApiLite) GetTransactionsWithResults(ctx context.Context, round uint64) ([]nodeapi.RuntimeTransactionWithResults, error)
- type KVStore
- type RuntimeApiMethod
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFromCacheOrCall ¶
func GetFromCacheOrCall[Value any](cache KVStore, volatile bool, key CacheKey, valueFunc func() (*Value, error)) (*Value, error)
getFromCacheOrCall fetches the value of `cacheKey` from the cache if it exists, interpreted as a `Value`. If it does not exist, it calls `valueFunc` to get the value, and caches it before returning it. If `volatile` is true, `valueFunc` is always called, and the result is not cached.
Types ¶
type FileConsensusApiLite ¶
type FileConsensusApiLite struct {
// contains filtered or unexported fields
}
FileConsensusApiLite provides access to the consensus API of an Oasis node. Since FileConsensusApiLite is backed by a file containing the cached responses to `ConsensusApiLite` calls, this data is inherently compatible with the current Nexus and can thus handle heights from both Cobalt/Damask.
func NewFileConsensusApiLite ¶
func NewFileConsensusApiLite(cacheDir string, consensusApi nodeapi.ConsensusApiLite) (*FileConsensusApiLite, error)
func (*FileConsensusApiLite) Close ¶
func (c *FileConsensusApiLite) Close() error
func (*FileConsensusApiLite) GetCommittees ¶
func (c *FileConsensusApiLite) GetCommittees(ctx context.Context, height int64, runtimeID coreCommon.Namespace) ([]nodeapi.Committee, error)
func (*FileConsensusApiLite) GetGenesisDocument ¶
func (*FileConsensusApiLite) GetProposal ¶
func (*FileConsensusApiLite) GetTransactionsWithResults ¶
func (c *FileConsensusApiLite) GetTransactionsWithResults(ctx context.Context, height int64) ([]nodeapi.TransactionWithResults, error)
func (*FileConsensusApiLite) GetValidators ¶
func (*FileConsensusApiLite) GovernanceEvents ¶
func (*FileConsensusApiLite) RegistryEvents ¶
func (*FileConsensusApiLite) RoothashEvents ¶
func (*FileConsensusApiLite) StakingEvents ¶
func (*FileConsensusApiLite) StateToGenesis ¶
type FileRuntimeApiLite ¶
type FileRuntimeApiLite struct {
// contains filtered or unexported fields
}
func NewFileRuntimeApiLite ¶
func NewFileRuntimeApiLite(runtime common.Runtime, cacheDir string, runtimeApi nodeapi.RuntimeApiLite) (*FileRuntimeApiLite, error)
func (*FileRuntimeApiLite) Close ¶
func (r *FileRuntimeApiLite) Close() error
func (*FileRuntimeApiLite) EVMGetCode ¶
func (*FileRuntimeApiLite) EVMSimulateCall ¶
func (*FileRuntimeApiLite) GetBlockHeader ¶
func (r *FileRuntimeApiLite) GetBlockHeader(ctx context.Context, round uint64) (*nodeapi.RuntimeBlockHeader, error)
func (*FileRuntimeApiLite) GetEventsRaw ¶
func (r *FileRuntimeApiLite) GetEventsRaw(ctx context.Context, round uint64) ([]nodeapi.RuntimeEvent, error)
func (*FileRuntimeApiLite) GetNativeBalance ¶
func (*FileRuntimeApiLite) GetTransactionsWithResults ¶
func (r *FileRuntimeApiLite) GetTransactionsWithResults(ctx context.Context, round uint64) ([]nodeapi.RuntimeTransactionWithResults, error)
type KVStore ¶
type KVStore interface { Has(key []byte) (bool, error) Get(key []byte) ([]byte, error) Put(key []byte, value []byte) error Close() error }
A key-value store. Additional method-like functions that give a typed interface to the store (i.e. with typed values/keys instead of []byte) are provided below, taking KVStore as the first argument so they can use generics.
type RuntimeApiMethod ¶
type RuntimeApiMethod func() (interface{}, error)