Documentation ¶
Index ¶
- Constants
- func GetApiInterfaceFromServiceApi(serviceApi *spectypes.ServiceApi, connectionType string) *spectypes.ApiInterface
- func GetListenerWithRetryGrpc(protocol string, addr string) net.Listener
- func ListenWithRetry(app *fiber.App, address string)
- type BaseChainParser
- type BaseChainProxy
- type ChainFetcher
- type ChainListener
- type ChainMessage
- type ChainMessageForSend
- type ChainParser
- type ChainProxy
- func GetChainProxy(ctx context.Context, nConns uint, ...) (ChainProxy, error)
- func NewGrpcChainProxy(ctx context.Context, nConns uint, ...) (ChainProxy, error)
- func NewJrpcChainProxy(ctx context.Context, nConns uint, ...) (ChainProxy, error)
- func NewRestChainProxy(ctx context.Context, nConns uint, ...) (ChainProxy, error)
- func NewtendermintRpcChainProxy(ctx context.Context, nConns uint, ...) (ChainProxy, error)
- type CraftData
- type GrpcChainListener
- type GrpcChainParser
- func (apip *GrpcChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, ...)
- func (apip *GrpcChainParser) CraftMessage(serviceApi spectypes.ServiceApi, craftData *CraftData) (ChainMessageForSend, error)
- func (apip *GrpcChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
- func (apip *GrpcChainParser) ParseMsg(url string, data []byte, connectionType string, ...) (ChainMessage, error)
- func (apip *GrpcChainParser) SetSpec(spec spectypes.Spec)
- type GrpcChainProxy
- type JrpcChainProxy
- type JsonRPCChainListener
- type JsonRPCChainParser
- func (apip *JsonRPCChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, ...)
- func (apip *JsonRPCChainParser) CraftMessage(serviceApi spectypes.ServiceApi, craftData *CraftData) (ChainMessageForSend, error)
- func (apip *JsonRPCChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
- func (apip *JsonRPCChainParser) GetInternalPaths() map[string]struct{}
- func (apip *JsonRPCChainParser) ParseMsg(url string, data []byte, connectionType string, ...) (ChainMessage, error)
- func (apip *JsonRPCChainParser) SetSpec(spec spectypes.Spec)
- type LavaChainFetcher
- type RelaySender
- type RestChainListener
- type RestChainParser
- func (apip *RestChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, ...)
- func (apip *RestChainParser) CraftMessage(serviceApi spectypes.ServiceApi, craftData *CraftData) (ChainMessageForSend, error)
- func (apip *RestChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
- func (apip *RestChainParser) ParseMsg(url string, data []byte, connectionType string, ...) (ChainMessage, error)
- func (apip *RestChainParser) SetSpec(spec spectypes.Spec)
- type RestChainProxy
- type TendermintChainParser
- func (apip *TendermintChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, ...)
- func (apip *TendermintChainParser) CraftMessage(serviceApi spectypes.ServiceApi, craftData *CraftData) (ChainMessageForSend, error)
- func (apip *TendermintChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
- func (apip *TendermintChainParser) ParseMsg(url string, data []byte, connectionType string, ...) (ChainMessage, error)
- func (apip *TendermintChainParser) SetSpec(spec spectypes.Spec)
- type TendermintRpcChainListener
Constants ¶
const ( ContextUserValueKeyDappID = "dappID" RetryListeningInterval = 10 // seconds )
const (
TendermintStatusQuery = "status"
)
Variables ¶
This section is empty.
Functions ¶
func GetApiInterfaceFromServiceApi ¶ added in v0.9.0
func GetApiInterfaceFromServiceApi(serviceApi *spectypes.ServiceApi, connectionType string) *spectypes.ApiInterface
func ListenWithRetry ¶
func ListenWithRetry(app *fiber.App, address string)
Types ¶
type BaseChainParser ¶
type BaseChainParser struct {
// contains filtered or unexported fields
}
func (*BaseChainParser) GetSpecApiByTag ¶ added in v0.9.0
func (bcp *BaseChainParser) GetSpecApiByTag(tag string) (spectypes.ServiceApi, bool)
func (*BaseChainParser) SetTaggedApis ¶ added in v0.9.0
func (bcp *BaseChainParser) SetTaggedApis(taggedApis map[string]spectypes.ServiceApi)
type BaseChainProxy ¶
type ChainFetcher ¶
type ChainFetcher struct {
// contains filtered or unexported fields
}
func NewChainFetcher ¶
func NewChainFetcher(ctx context.Context, chainProxy ChainProxy, chainParser ChainParser, endpoint *lavasession.RPCProviderEndpoint) *ChainFetcher
func (*ChainFetcher) FetchBlockHashByNum ¶
func (*ChainFetcher) FetchEndpoint ¶
func (cf *ChainFetcher) FetchEndpoint() lavasession.RPCProviderEndpoint
func (*ChainFetcher) FetchLatestBlockNum ¶
func (cf *ChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error)
type ChainListener ¶
func NewChainListener ¶
func NewChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, rpcConsumerLogs *metrics.RPCConsumerLogs) (ChainListener, error)
type ChainMessage ¶
type ChainMessage interface { RequestedBlock() int64 ChainMessageForSend }
type ChainMessageForSend ¶
type ChainMessageForSend interface { GetServiceApi() *spectypes.ServiceApi GetInterface() *spectypes.ApiInterface GetRPCMessage() parser.RPCInput }
func CraftChainMessage ¶
func CraftChainMessage(serviceApi spectypes.ServiceApi, chainParser ChainParser, craftData *CraftData) (ChainMessageForSend, error)
type ChainParser ¶
type ChainParser interface { ParseMsg(url string, data []byte, connectionType string, metadata []pairingtypes.Metadata) (ChainMessage, error) SetSpec(spec spectypes.Spec) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32, blocksInFinalizationProof uint32) GetSpecApiByTag(tag string) (specApi spectypes.ServiceApi, existed bool) CraftMessage(serviceApi spectypes.ServiceApi, craftData *CraftData) (ChainMessageForSend, error) }
func NewChainParser ¶
func NewChainParser(apiInterface string) (chainParser ChainParser, err error)
type ChainProxy ¶
type ChainProxy interface {
SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error) // has to be thread safe, reuse code within ParseMsg as common functionality
}
func GetChainProxy ¶ added in v0.5.0
func GetChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, chainParser ChainParser) (ChainProxy, error)
func NewGrpcChainProxy ¶
func NewGrpcChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, averageBlockTime time.Duration) (ChainProxy, error)
func NewJrpcChainProxy ¶
func NewJrpcChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, averageBlockTime time.Duration, chainParser ChainParser) (ChainProxy, error)
func NewRestChainProxy ¶
func NewRestChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, averageBlockTime time.Duration) (ChainProxy, error)
func NewtendermintRpcChainProxy ¶
func NewtendermintRpcChainProxy(ctx context.Context, nConns uint, rpcProviderEndpoint *lavasession.RPCProviderEndpoint, averageBlockTime time.Duration) (ChainProxy, error)
type GrpcChainListener ¶
type GrpcChainListener struct {
// contains filtered or unexported fields
}
func NewGrpcChainListener ¶
func NewGrpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, rpcConsumerLogs *metrics.RPCConsumerLogs) (chainListener *GrpcChainListener)
func (*GrpcChainListener) Serve ¶
func (apil *GrpcChainListener) Serve(ctx context.Context)
Serve http server for GrpcChainListener
type GrpcChainParser ¶
type GrpcChainParser struct { BaseChainParser // contains filtered or unexported fields }
func NewGrpcChainParser ¶
func NewGrpcChainParser() (chainParser *GrpcChainParser, err error)
NewGrpcChainParser creates a new instance of GrpcChainParser
func (*GrpcChainParser) ChainBlockStats ¶
func (apip *GrpcChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32, blocksInFinalizationProof uint32)
ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData)
func (*GrpcChainParser) CraftMessage ¶
func (apip *GrpcChainParser) CraftMessage(serviceApi spectypes.ServiceApi, craftData *CraftData) (ChainMessageForSend, error)
func (*GrpcChainParser) DataReliabilityParams ¶
func (apip *GrpcChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)
func (*GrpcChainParser) ParseMsg ¶
func (apip *GrpcChainParser) ParseMsg(url string, data []byte, connectionType string, metadata []pairingtypes.Metadata) (ChainMessage, error)
ParseMsg parses message data into chain message object
func (*GrpcChainParser) SetSpec ¶
func (apip *GrpcChainParser) SetSpec(spec spectypes.Spec)
SetSpec sets the spec for the GrpcChainParser
type GrpcChainProxy ¶
type GrpcChainProxy struct { BaseChainProxy // contains filtered or unexported fields }
func (*GrpcChainProxy) SendNodeMsg ¶
func (cp *GrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)
type JrpcChainProxy ¶
type JrpcChainProxy struct { BaseChainProxy // contains filtered or unexported fields }
func (*JrpcChainProxy) SendNodeMsg ¶
func (cp *JrpcChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)
type JsonRPCChainListener ¶
type JsonRPCChainListener struct {
// contains filtered or unexported fields
}
func NewJrpcChainListener ¶
func NewJrpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, rpcConsumerLogs *metrics.RPCConsumerLogs) (chainListener *JsonRPCChainListener)
NewJrpcChainListener creates a new instance of JsonRPCChainListener
func (*JsonRPCChainListener) Serve ¶
func (apil *JsonRPCChainListener) Serve(ctx context.Context)
Serve http server for JsonRPCChainListener
type JsonRPCChainParser ¶
type JsonRPCChainParser struct { BaseChainParser // contains filtered or unexported fields }
func NewJrpcChainParser ¶
func NewJrpcChainParser() (chainParser *JsonRPCChainParser, err error)
NewJrpcChainParser creates a new instance of JsonRPCChainParser
func (*JsonRPCChainParser) ChainBlockStats ¶
func (apip *JsonRPCChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32, blocksInFinalizationProof uint32)
ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData)
func (*JsonRPCChainParser) CraftMessage ¶
func (apip *JsonRPCChainParser) CraftMessage(serviceApi spectypes.ServiceApi, craftData *CraftData) (ChainMessageForSend, error)
func (*JsonRPCChainParser) DataReliabilityParams ¶
func (apip *JsonRPCChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)
func (*JsonRPCChainParser) GetInternalPaths ¶
func (apip *JsonRPCChainParser) GetInternalPaths() map[string]struct{}
func (*JsonRPCChainParser) ParseMsg ¶
func (apip *JsonRPCChainParser) ParseMsg(url string, data []byte, connectionType string, metadata []pairingtypes.Metadata) (ChainMessage, error)
this func parses message data into chain message object
func (*JsonRPCChainParser) SetSpec ¶
func (apip *JsonRPCChainParser) SetSpec(spec spectypes.Spec)
SetSpec sets the spec for the JsonRPCChainParser
type LavaChainFetcher ¶
type LavaChainFetcher struct {
// contains filtered or unexported fields
}
func NewLavaChainFetcher ¶
func NewLavaChainFetcher(ctx context.Context, clientCtx client.Context) *LavaChainFetcher
func (*LavaChainFetcher) FetchBlockHashByNum ¶
func (*LavaChainFetcher) FetchEndpoint ¶
func (lcf *LavaChainFetcher) FetchEndpoint() lavasession.RPCProviderEndpoint
func (*LavaChainFetcher) FetchLatestBlockNum ¶
func (lcf *LavaChainFetcher) FetchLatestBlockNum(ctx context.Context) (int64, error)
type RelaySender ¶
type RelaySender interface { SendRelay( ctx context.Context, url string, req string, connectionType string, dappID string, analytics *metrics.RelayMetrics, metadataValues []pairingtypes.Metadata, ) (*pairingtypes.RelayReply, *pairingtypes.Relayer_RelaySubscribeClient, error) }
type RestChainListener ¶
type RestChainListener struct {
// contains filtered or unexported fields
}
func NewRestChainListener ¶
func NewRestChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, rpcConsumerLogs *metrics.RPCConsumerLogs) (chainListener *RestChainListener)
NewRestChainListener creates a new instance of RestChainListener
func (*RestChainListener) Serve ¶
func (apil *RestChainListener) Serve(ctx context.Context)
Serve http server for RestChainListener
type RestChainParser ¶
type RestChainParser struct { BaseChainParser // contains filtered or unexported fields }
func NewRestChainParser ¶
func NewRestChainParser() (chainParser *RestChainParser, err error)
NewRestChainParser creates a new instance of RestChainParser
func (*RestChainParser) ChainBlockStats ¶
func (apip *RestChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32, blocksInFinalizationProof uint32)
ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData)
func (*RestChainParser) CraftMessage ¶
func (apip *RestChainParser) CraftMessage(serviceApi spectypes.ServiceApi, craftData *CraftData) (ChainMessageForSend, error)
func (*RestChainParser) DataReliabilityParams ¶
func (apip *RestChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)
func (*RestChainParser) ParseMsg ¶
func (apip *RestChainParser) ParseMsg(url string, data []byte, connectionType string, metadata []pairingtypes.Metadata) (ChainMessage, error)
ParseMsg parses message data into chain message object
func (*RestChainParser) SetSpec ¶
func (apip *RestChainParser) SetSpec(spec spectypes.Spec)
SetSpec sets the spec for the RestChainParser
type RestChainProxy ¶
type RestChainProxy struct {
BaseChainProxy
}
func (*RestChainProxy) SendNodeMsg ¶
func (rcp *RestChainProxy) SendNodeMsg(ctx context.Context, ch chan interface{}, chainMessage ChainMessageForSend) (relayReply *pairingtypes.RelayReply, subscriptionID string, relayReplyServer *rpcclient.ClientSubscription, err error)
type TendermintChainParser ¶
type TendermintChainParser struct { BaseChainParser // contains filtered or unexported fields }
func NewTendermintRpcChainParser ¶
func NewTendermintRpcChainParser() (chainParser *TendermintChainParser, err error)
NewTendermintRpcChainParser creates a new instance of TendermintChainParser
func (*TendermintChainParser) ChainBlockStats ¶
func (apip *TendermintChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32, blocksInFinalizationProof uint32)
ChainBlockStats returns block stats from spec (spec.AllowedBlockLagForQosSync, spec.AverageBlockTime, spec.BlockDistanceForFinalizedData, spec.BlocksInFinalizationProof)
func (*TendermintChainParser) CraftMessage ¶
func (apip *TendermintChainParser) CraftMessage(serviceApi spectypes.ServiceApi, craftData *CraftData) (ChainMessageForSend, error)
func (*TendermintChainParser) DataReliabilityParams ¶
func (apip *TendermintChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
DataReliabilityParams returns data reliability params from spec (spec.enabled and spec.dataReliabilityThreshold)
func (*TendermintChainParser) ParseMsg ¶
func (apip *TendermintChainParser) ParseMsg(url string, data []byte, connectionType string, metadata []pairingtypes.Metadata) (ChainMessage, error)
ParseMsg parses message data into chain message object
func (*TendermintChainParser) SetSpec ¶
func (apip *TendermintChainParser) SetSpec(spec spectypes.Spec)
SetSpec sets the spec for the TendermintChainParser
type TendermintRpcChainListener ¶
type TendermintRpcChainListener struct {
// contains filtered or unexported fields
}
func NewTendermintRpcChainListener ¶
func NewTendermintRpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender, rpcConsumerLogs *metrics.RPCConsumerLogs) (chainListener *TendermintRpcChainListener)
NewTendermintRpcChainListener creates a new instance of TendermintRpcChainListener
func (*TendermintRpcChainListener) Serve ¶
func (apil *TendermintRpcChainListener) Serve(ctx context.Context)
Serve http server for TendermintRpcChainListener