chainlib

package
v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainListener

type ChainListener interface {
	Serve()
}

func NewChainListener

func NewChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender) (ChainListener, error)

type ChainMessage

type ChainMessage interface {
	GetServiceApi() *spectypes.ServiceApi
	GetInterface() *spectypes.ApiInterface
	RequestedBlock() int64
}

type ChainParser

type ChainParser interface {
	ParseMsg(url string, data []byte, connectionType string) (ChainMessage, error) // has to be thread safe
	SetSpec(spec spectypes.Spec)                                                   // has to be thread safe
	DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)
	ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32)
}

this is an interface for parsing and generating messages of the supported APIType it checks for the existence of the method in the spec, and formats the message

func NewChainParser

func NewChainParser(apiInterface string) (chainParser ChainParser, err error)

type GrpcChainListener

type GrpcChainListener struct{}

func NewGrpcChainListener

func NewGrpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender) (chainListener *GrpcChainListener)

func (*GrpcChainListener) Serve

func (apil *GrpcChainListener) Serve()

type GrpcChainParser

type GrpcChainParser struct{}

func NewGrpcChainParser

func NewGrpcChainParser() (chainParser *GrpcChainParser, err error)

func (*GrpcChainParser) ChainBlockStats

func (apip *GrpcChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32)

func (*GrpcChainParser) DataReliabilityParams

func (apip *GrpcChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)

func (*GrpcChainParser) ParseMsg

func (apip *GrpcChainParser) ParseMsg(url string, data []byte, connectionType string) (ChainMessage, error)

func (*GrpcChainParser) SetSpec

func (apip *GrpcChainParser) SetSpec(spec spectypes.Spec)

type JsonRPCChainListener

type JsonRPCChainListener struct{}

func NewJrpcChainListener

func NewJrpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender) (chainListener *JsonRPCChainListener)

func (*JsonRPCChainListener) Serve

func (apil *JsonRPCChainListener) Serve()

type JsonRPCChainParser

type JsonRPCChainParser struct{}

func NewJrpcChainParser

func NewJrpcChainParser() (chainParser *JsonRPCChainParser, err error)

func (*JsonRPCChainParser) ChainBlockStats

func (apip *JsonRPCChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32)

func (*JsonRPCChainParser) DataReliabilityParams

func (apip *JsonRPCChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)

func (*JsonRPCChainParser) ParseMsg

func (apip *JsonRPCChainParser) ParseMsg(url string, data []byte, connectionType string) (ChainMessage, error)

func (*JsonRPCChainParser) SetSpec

func (apip *JsonRPCChainParser) SetSpec(spec spectypes.Spec)

type RelaySender

type RelaySender interface {
	SendRelay(
		ctx context.Context,
		url string,
		req string,
		connectionType string,
		dappID string,
	) (*pairingtypes.RelayReply, *pairingtypes.Relayer_RelaySubscribeClient, error)
}

type RestChainListener

type RestChainListener struct{}

func NewRestChainListener

func NewRestChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender) (chainListener *RestChainListener)

func (*RestChainListener) Serve

func (apil *RestChainListener) Serve()

type RestChainParser

type RestChainParser struct{}

func NewRestChainParser

func NewRestChainParser() (chainParser *RestChainParser, err error)

func (*RestChainParser) ChainBlockStats

func (apip *RestChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32)

func (*RestChainParser) DataReliabilityParams

func (apip *RestChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)

func (*RestChainParser) ParseMsg

func (apip *RestChainParser) ParseMsg(url string, data []byte, connectionType string) (ChainMessage, error)

func (*RestChainParser) SetSpec

func (apip *RestChainParser) SetSpec(spec spectypes.Spec)

type TendermintChainParser

type TendermintChainParser struct{}

func NewTendermintRpcChainParser

func NewTendermintRpcChainParser() (chainParser *TendermintChainParser, err error)

func (*TendermintChainParser) ChainBlockStats

func (apip *TendermintChainParser) ChainBlockStats() (allowedBlockLagForQosSync int64, averageBlockTime time.Duration, blockDistanceForFinalizedData uint32)

func (*TendermintChainParser) DataReliabilityParams

func (apip *TendermintChainParser) DataReliabilityParams() (enabled bool, dataReliabilityThreshold uint32)

func (*TendermintChainParser) ParseMsg

func (apip *TendermintChainParser) ParseMsg(url string, data []byte, connectionType string) (ChainMessage, error)

func (*TendermintChainParser) SetSpec

func (apip *TendermintChainParser) SetSpec(spec spectypes.Spec)

type TendermintRpcChainListener

type TendermintRpcChainListener struct{}

func NewTendermintRpcChainListener

func NewTendermintRpcChainListener(ctx context.Context, listenEndpoint *lavasession.RPCEndpoint, relaySender RelaySender) (chainListener *TendermintRpcChainListener)

func (*TendermintRpcChainListener) Serve

func (apil *TendermintRpcChainListener) Serve()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL