protocol

package
v0.0.0-...-da4b772 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseError int = iota
	NoAvailableUpstreams
	WrongChain
	CtxErrorCode
	WsTotalFailure
	ClientErrorCode         = 400
	AuthErrorCode           = 403
	RequestTimeout          = 408
	InternalServerErrorCode = 500
	RateLimitExceeded       = 429
	NoSupportedMethod       = -32601
	IncorrectResponseBody   = -32001
	QuorumSignatureErrCode  = -32010
)
View Source
const MaxChunkSize = 8192
View Source
const MethodSeparator = "#"

Variables

This section is empty.

Functions

func IsRetryable

func IsRetryable(response ResponseHolder) bool

func IsStream

func IsStream(method string) bool

func ResponseCanBeStreamed

func ResponseCanBeStreamed(reader *bufio.Reader, chunkSize int) bool

func ResultAsNumber

func ResultAsNumber(result []byte) uint64

func ResultAsString

func ResultAsString(result []byte) string

func ToHttpCode

func ToHttpCode(response ResponseHolder) int

Types

type AbstractUpstreamStateEvent

type AbstractUpstreamStateEvent interface {
	ProcessEvent(state UpstreamState) UpstreamState
	Same(state UpstreamState) bool
}

type ApiConnectorType

type ApiConnectorType int
const (
	JsonRpcConnector ApiConnectorType = iota
	RestConnector
	GrpcConnector
	WsConnector
)

func (ApiConnectorType) String

func (a ApiConnectorType) String() string

type AvailabilityStatus

type AvailabilityStatus int
const (
	Available AvailabilityStatus = iota + 1
	Immature
	Syncing
	Unavailable

	UnknownStatus = math.MaxInt
)

func (AvailabilityStatus) String

func (a AvailabilityStatus) String() string

type BanMethodUpstreamStateEvent

type BanMethodUpstreamStateEvent struct {
	Method string
}

func (*BanMethodUpstreamStateEvent) ProcessEvent

func (*BanMethodUpstreamStateEvent) Same

type BaseUpstreamResponse

type BaseUpstreamResponse struct {
	// contains filtered or unexported fields
}

func NewHttpUpstreamResponse

func NewHttpUpstreamResponse(id string, body []byte, responseCode int, requestType RequestType) *BaseUpstreamResponse

func NewHttpUpstreamResponseStream

func NewHttpUpstreamResponseStream(id string, reader io.Reader, requestType RequestType) *BaseUpstreamResponse

func NewHttpUpstreamResponseWithError

func NewHttpUpstreamResponseWithError(error *ResponseError) *BaseUpstreamResponse

func NewSimpleHttpUpstreamResponse

func NewSimpleHttpUpstreamResponse(id string, body []byte, requestType RequestType) *BaseUpstreamResponse

func (*BaseUpstreamResponse) EncodeResponse

func (h *BaseUpstreamResponse) EncodeResponse(realId []byte) io.Reader

func (*BaseUpstreamResponse) GetError

func (h *BaseUpstreamResponse) GetError() *ResponseError

func (*BaseUpstreamResponse) HasError

func (h *BaseUpstreamResponse) HasError() bool

func (*BaseUpstreamResponse) HasStream

func (h *BaseUpstreamResponse) HasStream() bool

func (*BaseUpstreamResponse) Id

func (h *BaseUpstreamResponse) Id() string

func (*BaseUpstreamResponse) ResponseCode

func (h *BaseUpstreamResponse) ResponseCode() int

func (*BaseUpstreamResponse) ResponseHeaders

func (h *BaseUpstreamResponse) ResponseHeaders() http.Header

func (*BaseUpstreamResponse) ResponseResult

func (h *BaseUpstreamResponse) ResponseResult() []byte

func (*BaseUpstreamResponse) ResponseResultString

func (h *BaseUpstreamResponse) ResponseResultString() (string, error)

func (*BaseUpstreamResponse) WithResponseHeaders

func (h *BaseUpstreamResponse) WithResponseHeaders(headers http.Header) *BaseUpstreamResponse

type Block

type Block struct {
	Height     uint64
	Slot       uint64
	Hash       blockchain.HashId
	ParentHash blockchain.HashId
}

func NewBlock

func NewBlock(height, slot uint64, hash, parentHash blockchain.HashId) Block

func NewBlockWithHeight

func NewBlockWithHeight(height uint64) Block

func NewBlockWithHeights

func NewBlockWithHeights(height, slot uint64) Block

func (Block) CompareWithHeight

func (b Block) CompareWithHeight(other Block) int

func (Block) Equals

func (b Block) Equals(other Block) bool

func (Block) IsEmptyByHeight

func (b Block) IsEmptyByHeight() bool

func (Block) IsFullEmpty

func (b Block) IsFullEmpty() bool

type BlockInfo

type BlockInfo struct {
	// contains filtered or unexported fields
}

func NewBlockInfo

func NewBlockInfo() *BlockInfo

func (*BlockInfo) AddBlock

func (b *BlockInfo) AddBlock(data Block, blockType BlockType)

func (*BlockInfo) Copy

func (b *BlockInfo) Copy() *BlockInfo

func (*BlockInfo) GetBlock

func (b *BlockInfo) GetBlock(blockType BlockType) Block

func (*BlockInfo) GetBlocks

func (b *BlockInfo) GetBlocks() map[BlockType]Block

type BlockType

type BlockType int
const (
	FinalizedBlock BlockType = iota
)

func (BlockType) String

func (b BlockType) String() string

type BlockUpstreamStateEvent

type BlockUpstreamStateEvent struct {
	Block     Block
	BlockType BlockType
}

func (*BlockUpstreamStateEvent) ProcessEvent

func (b *BlockUpstreamStateEvent) ProcessEvent(state UpstreamState) UpstreamState

func (*BlockUpstreamStateEvent) Same

type Cap

type Cap int
const (
	WsCap Cap = iota
)

type ClientRetryableError

type ClientRetryableError struct {
	// contains filtered or unexported fields
}

func NewClientRetryableError

func NewClientRetryableError(err error) *ClientRetryableError

func (ClientRetryableError) Error

func (e ClientRetryableError) Error() string

type CloseReader

type CloseReader struct {
	// contains filtered or unexported fields
}

func NewCloseReader

func NewCloseReader(ctx context.Context, mainReader io.Reader, readerToClose io.ReadCloser) *CloseReader

func (*CloseReader) Read

func (c *CloseReader) Read(p []byte) (n int, err error)

type FatalErrorUpstreamStateEvent

type FatalErrorUpstreamStateEvent struct{}

func (*FatalErrorUpstreamStateEvent) ProcessEvent

func (*FatalErrorUpstreamStateEvent) Same

type HasResponseHeaders

type HasResponseHeaders interface {
	ResponseHeaders() http.Header
}

HasResponseHeaders is an optional capability for response holders that carry upstream HTTP response headers (e.g. QR<N>-id-* quorum signatures). Kept separate from ResponseHolder to avoid forcing every implementation.

type HeadUpstreamEvent

type HeadUpstreamEvent struct {
	Status AvailabilityStatus
	Head   Block
}

type HeadUpstreamStateEvent

type HeadUpstreamStateEvent struct {
	HeadData Block
}

func (*HeadUpstreamStateEvent) ProcessEvent

func (h *HeadUpstreamStateEvent) ProcessEvent(state UpstreamState) UpstreamState

func (*HeadUpstreamStateEvent) Same

type HttpMethod

type HttpMethod int
const (
	Get HttpMethod = iota
	Post
)

func (HttpMethod) String

func (h HttpMethod) String() string

type JsonRpcRequestBody

type JsonRpcRequestBody struct {
	Id      json.RawMessage `json:"id"`
	Jsonrpc string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params"`
}

type JsonRpcWsUpstreamResponse

type JsonRpcWsUpstreamResponse struct {
	// contains filtered or unexported fields
}

func NewJsonRpcWsUpstreamResponse

func NewJsonRpcWsUpstreamResponse(messages chan *WsResponse, subOpId string) *JsonRpcWsUpstreamResponse

func (*JsonRpcWsUpstreamResponse) OpId

func (*JsonRpcWsUpstreamResponse) ResponseChan

func (j *JsonRpcWsUpstreamResponse) ResponseChan() chan *WsResponse

type Labels

type Labels struct {
	// contains filtered or unexported fields
}

func NewLabels

func NewLabels() *Labels

func (*Labels) AddLabel

func (l *Labels) AddLabel(key, value string)

func (*Labels) Copy

func (l *Labels) Copy() *Labels

func (*Labels) GetAllLabels

func (l *Labels) GetAllLabels() map[string]string

func (*Labels) GetLabel

func (l *Labels) GetLabel(label string) (string, bool)

type LabelsUpstreamStateEvent

type LabelsUpstreamStateEvent struct {
	Labels lo.Tuple2[string, string]
}

func (*LabelsUpstreamStateEvent) ProcessEvent

func (l *LabelsUpstreamStateEvent) ProcessEvent(state UpstreamState) UpstreamState

func (*LabelsUpstreamStateEvent) Same

type LowerBoundData

type LowerBoundData struct {
	Bound     int64
	Timestamp int64
	Type      LowerBoundType
}

func NewLowerBoundData

func NewLowerBoundData(bound, timestamp int64, boundType LowerBoundType) LowerBoundData

func NewLowerBoundDataNow

func NewLowerBoundDataNow(bound int64, boundType LowerBoundType) LowerBoundData

type LowerBoundInfo

type LowerBoundInfo struct {
	// contains filtered or unexported fields
}

func NewLowerBoundInfo

func NewLowerBoundInfo() *LowerBoundInfo

func (*LowerBoundInfo) AddLowerBound

func (l *LowerBoundInfo) AddLowerBound(data LowerBoundData)

func (*LowerBoundInfo) Copy

func (l *LowerBoundInfo) Copy() *LowerBoundInfo

func (*LowerBoundInfo) GetAllBounds

func (l *LowerBoundInfo) GetAllBounds() []LowerBoundData

func (*LowerBoundInfo) GetLowerBound

func (l *LowerBoundInfo) GetLowerBound(boundType LowerBoundType) (LowerBoundData, bool)

type LowerBoundType

type LowerBoundType int
const (
	UnknownBound LowerBoundType = iota + 1
	SlotBound
	StateBound
	ReceiptsBound
	TxBound
	BlockBound
)

func (LowerBoundType) String

func (t LowerBoundType) String() string

type LowerBoundUpstreamStateEvent

type LowerBoundUpstreamStateEvent struct {
	Data LowerBoundData
}

func (*LowerBoundUpstreamStateEvent) ProcessEvent

func (*LowerBoundUpstreamStateEvent) Same

type RemoveUpstreamEvent

type RemoveUpstreamEvent struct{}

type ReplyError

type ReplyError struct {
	ErrorKind ResponseErrorKind
	// contains filtered or unexported fields
}

func NewPartialFailure

func NewPartialFailure(request RequestHolder, responseError *ResponseError) *ReplyError

func NewReplyError

func NewReplyError(id string, responseError *ResponseError, responseType RequestType, errorKind ResponseErrorKind) *ReplyError

func NewTotalFailure

func NewTotalFailure(request RequestHolder, responseError *ResponseError) *ReplyError

func NewTotalFailureFromErr

func NewTotalFailureFromErr(id string, err error, responseType RequestType) *ReplyError

func (*ReplyError) EncodeResponse

func (r *ReplyError) EncodeResponse(realId []byte) io.Reader

func (*ReplyError) GetError

func (r *ReplyError) GetError() *ResponseError

func (*ReplyError) HasError

func (r *ReplyError) HasError() bool

func (*ReplyError) HasStream

func (r *ReplyError) HasStream() bool

func (*ReplyError) Id

func (r *ReplyError) Id() string

func (*ReplyError) ResponseCode

func (r *ReplyError) ResponseCode() int

func (*ReplyError) ResponseResult

func (r *ReplyError) ResponseResult() []byte

func (*ReplyError) ResponseResultString

func (r *ReplyError) ResponseResultString() (string, error)

type RequestHolder

type RequestHolder interface {
	Id() string
	Method() string
	Headers() map[string]string
	Body() ([]byte, error)
	ParseParams(ctx context.Context) specs.MethodParam
	RequestType() RequestType
	RequestHash() string
	SpecMethod() *specs.Method
	RequestObserver() *RequestObserver

	ModifyParams(ctx context.Context, newValue any)

	IsStream() bool
	IsSubscribe() bool
}

type RequestKind

type RequestKind int
const (
	UnknownReqKind RequestKind = iota
	InternalUnary
	InternalSubscription
	Local
	Cached
	Unary
	Subscription
)

func (RequestKind) String

func (r RequestKind) String() string

type RequestObserver

type RequestObserver struct {
	// contains filtered or unexported fields
}

func NewRequestObserver

func NewRequestObserver(isSub bool) *RequestObserver

func (*RequestObserver) AddResult

func (b *RequestObserver) AddResult(result RequestResult, final bool)

func (*RequestObserver) GetChain

func (b *RequestObserver) GetChain() chains.Chain

func (*RequestObserver) GetRequestKind

func (b *RequestObserver) GetRequestKind() RequestKind

func (*RequestObserver) GetResults

func (b *RequestObserver) GetResults() []RequestResult

func (*RequestObserver) TrackUpstreamCall

func (b *RequestObserver) TrackUpstreamCall() func()

func (*RequestObserver) WithApiKey

func (b *RequestObserver) WithApiKey(apiKey string) *RequestObserver

func (*RequestObserver) WithChain

func (b *RequestObserver) WithChain(chain chains.Chain) *RequestObserver

func (*RequestObserver) WithMethod

func (b *RequestObserver) WithMethod(method string) *RequestObserver

func (*RequestObserver) WithRequestKind

func (b *RequestObserver) WithRequestKind(kind RequestKind) *RequestObserver

type RequestResult

type RequestResult interface {
	// contains filtered or unexported methods
}

type RequestType

type RequestType int
const (
	Rest RequestType = iota
	JsonRpc
	Ws
	Grpc
	Unknown
)

func (RequestType) String

func (r RequestType) String() string

type ResponseError

type ResponseError struct {
	Code    int
	Message string
	Data    interface{}
}

func AuthError

func AuthError(cause error) *ResponseError

func ClientError

func ClientError(cause error) *ResponseError

func CtxError

func CtxError(cause error) *ResponseError

func IncorrectResponseBodyError

func IncorrectResponseBodyError(cause error) *ResponseError

func NoAvailableUpstreamsError

func NoAvailableUpstreamsError() *ResponseError

func NotSupportedMethodError

func NotSupportedMethodError(method string) *ResponseError

func ParseError

func ParseError() *ResponseError

func QuorumInsufficientSignaturesError

func QuorumInsufficientSignaturesError(got, required int) *ResponseError

func QuorumInvalidSignatureError

func QuorumInvalidSignatureError(providerID string) *ResponseError

func QuorumMalformedHeaderError

func QuorumMalformedHeaderError(cause error) *ResponseError

func QuorumMissingSignaturesError

func QuorumMissingSignaturesError() *ResponseError

func QuorumNotSupportedError

func QuorumNotSupportedError(reason string) *ResponseError

func QuorumUnexpectedRequestIDError

func QuorumUnexpectedRequestIDError(expected, got string) *ResponseError

func QuorumUnknownProviderError

func QuorumUnknownProviderError(providerID string) *ResponseError

func QuorumVerificationError

func QuorumVerificationError(cause error) *ResponseError

func RateLimitError

func RateLimitError() *ResponseError

func RequestTimeoutError

func RequestTimeoutError() *ResponseError

func ResponseErrorWithData

func ResponseErrorWithData(code int, message string, data interface{}) *ResponseError

func ResponseErrorWithMessage

func ResponseErrorWithMessage(message string) *ResponseError

func ServerError

func ServerError() *ResponseError

func ServerErrorWithCause

func ServerErrorWithCause(cause error) *ResponseError

func WrongChainError

func WrongChainError(chain string) *ResponseError

func WsTotalFailureError

func WsTotalFailureError() *ResponseError

func (*ResponseError) Error

func (b *ResponseError) Error() string

type ResponseErrorKind

type ResponseErrorKind int
const (
	PartialFailure ResponseErrorKind = iota
	TotalFailure
)

type ResponseHolder

type ResponseHolder interface {
	ResponseResult() []byte
	ResponseResultString() (string, error)
	ResponseCode() int
	GetError() *ResponseError
	EncodeResponse(realId []byte) io.Reader
	HasError() bool
	HasStream() bool
	Id() string
}

type ResponseHolderWrapper

type ResponseHolderWrapper struct {
	UpstreamId string
	RequestId  string
	Response   ResponseHolder
}

type ResponseKind

type ResponseKind int
const (
	UnknownRespKind ResponseKind = iota
	Ok
	Cancelled
	Error
	RetryableError
	RoutingError
)

func GetRespKindFromResponse

func GetRespKindFromResponse(response ResponseHolder) ResponseKind

func (ResponseKind) String

func (r ResponseKind) String() string

type ResponseReceivedHook

type ResponseReceivedHook interface {
	OnResponseReceived(ctx context.Context, request RequestHolder, respWrapper *ResponseHolderWrapper)
}

type ResultType

type ResultType int
const (
	ResultOk ResultType = iota
	ResultOkWithError
	ResultPartialFailure
	ResultTotalFailure
	ResultStop
)

func GetResponseType

func GetResponseType(wrapper *ResponseHolderWrapper, err error) ResultType

type StateUpstreamEvent

type StateUpstreamEvent struct {
	State *UpstreamState
}

type StatusUpstreamStateEvent

type StatusUpstreamStateEvent struct {
	Status AvailabilityStatus
}

func (*StatusUpstreamStateEvent) ProcessEvent

func (s *StatusUpstreamStateEvent) ProcessEvent(state UpstreamState) UpstreamState

func (*StatusUpstreamStateEvent) Same

type StopRetryErr

type StopRetryErr struct {
}

func (StopRetryErr) Error

func (s StopRetryErr) Error() string

type SubscribeConnectorState

type SubscribeConnectorState int
const (
	WsDisconnected SubscribeConnectorState = iota
	WsConnected
)

type SubscribeUpstreamStateEvent

type SubscribeUpstreamStateEvent struct {
	State SubscribeConnectorState
}

func (*SubscribeUpstreamStateEvent) ProcessEvent

func (*SubscribeUpstreamStateEvent) Same

type SubscriptionEventResponse

type SubscriptionEventResponse struct {
	// contains filtered or unexported fields
}

func NewSubscriptionEventResponse

func NewSubscriptionEventResponse(id string, event []byte) *SubscriptionEventResponse

func (*SubscriptionEventResponse) EncodeResponse

func (s *SubscriptionEventResponse) EncodeResponse(realId []byte) io.Reader

func (*SubscriptionEventResponse) GetError

func (*SubscriptionEventResponse) HasError

func (s *SubscriptionEventResponse) HasError() bool

func (*SubscriptionEventResponse) HasStream

func (s *SubscriptionEventResponse) HasStream() bool

func (*SubscriptionEventResponse) Id

func (*SubscriptionEventResponse) IsEventFrame

func (s *SubscriptionEventResponse) IsEventFrame() bool

func (*SubscriptionEventResponse) ResponseCode

func (s *SubscriptionEventResponse) ResponseCode() int

func (*SubscriptionEventResponse) ResponseResult

func (s *SubscriptionEventResponse) ResponseResult() []byte

func (*SubscriptionEventResponse) ResponseResultString

func (s *SubscriptionEventResponse) ResponseResultString() (string, error)

type SubscriptionMessageResponse

type SubscriptionMessageResponse struct {
	// contains filtered or unexported fields
}

func NewSubscriptionMessageEventResponse

func NewSubscriptionMessageEventResponse(id string, message []byte) *SubscriptionMessageResponse

func (*SubscriptionMessageResponse) EncodeResponse

func (s *SubscriptionMessageResponse) EncodeResponse(realId []byte) io.Reader

func (*SubscriptionMessageResponse) GetError

func (*SubscriptionMessageResponse) HasError

func (s *SubscriptionMessageResponse) HasError() bool

func (*SubscriptionMessageResponse) HasStream

func (s *SubscriptionMessageResponse) HasStream() bool

func (*SubscriptionMessageResponse) Id

func (*SubscriptionMessageResponse) IsEventFrame

func (s *SubscriptionMessageResponse) IsEventFrame() bool

func (*SubscriptionMessageResponse) ResponseCode

func (s *SubscriptionMessageResponse) ResponseCode() int

func (*SubscriptionMessageResponse) ResponseResult

func (s *SubscriptionMessageResponse) ResponseResult() []byte

func (*SubscriptionMessageResponse) ResponseResultString

func (s *SubscriptionMessageResponse) ResponseResultString() (string, error)

type SubscriptionMethodResultResponse

type SubscriptionMethodResultResponse struct {
	// contains filtered or unexported fields
}

func NewSubscriptionMethodResultResponse

func NewSubscriptionMethodResultResponse(id, method string, result []byte, subId json.RawMessage) *SubscriptionMethodResultResponse

func (*SubscriptionMethodResultResponse) EncodeResponse

func (s *SubscriptionMethodResultResponse) EncodeResponse(_ []byte) io.Reader

func (*SubscriptionMethodResultResponse) GetError

func (*SubscriptionMethodResultResponse) HasError

func (s *SubscriptionMethodResultResponse) HasError() bool

func (*SubscriptionMethodResultResponse) HasStream

func (s *SubscriptionMethodResultResponse) HasStream() bool

func (*SubscriptionMethodResultResponse) Id

func (*SubscriptionMethodResultResponse) IsEventFrame

func (s *SubscriptionMethodResultResponse) IsEventFrame() bool

func (*SubscriptionMethodResultResponse) ResponseCode

func (s *SubscriptionMethodResultResponse) ResponseCode() int

func (*SubscriptionMethodResultResponse) ResponseResult

func (s *SubscriptionMethodResultResponse) ResponseResult() []byte

func (*SubscriptionMethodResultResponse) ResponseResultString

func (s *SubscriptionMethodResultResponse) ResponseResultString() (string, error)

type SubscriptionResponseHolder

type SubscriptionResponseHolder interface {
	ResponseHolder
	IsEventFrame() bool
}

type SubscriptionResultResponse

type SubscriptionResultResponse struct {
	// contains filtered or unexported fields
}

func NewSubscriptionResultEventResponse

func NewSubscriptionResultEventResponse(id string, result []byte) *SubscriptionResultResponse

func (*SubscriptionResultResponse) EncodeResponse

func (s *SubscriptionResultResponse) EncodeResponse(realId []byte) io.Reader

func (*SubscriptionResultResponse) GetError

func (*SubscriptionResultResponse) HasError

func (s *SubscriptionResultResponse) HasError() bool

func (*SubscriptionResultResponse) HasStream

func (s *SubscriptionResultResponse) HasStream() bool

func (*SubscriptionResultResponse) Id

func (*SubscriptionResultResponse) IsEventFrame

func (s *SubscriptionResultResponse) IsEventFrame() bool

func (*SubscriptionResultResponse) ResponseCode

func (s *SubscriptionResultResponse) ResponseCode() int

func (*SubscriptionResultResponse) ResponseResult

func (s *SubscriptionResultResponse) ResponseResult() []byte

func (*SubscriptionResultResponse) ResponseResultString

func (s *SubscriptionResultResponse) ResponseResultString() (string, error)

type UnaryRequestResult

type UnaryRequestResult struct {
	// contains filtered or unexported fields
}

func NewUnaryRequestResult

func NewUnaryRequestResult() *UnaryRequestResult

func (*UnaryRequestResult) GetApiKey

func (u *UnaryRequestResult) GetApiKey() string

func (*UnaryRequestResult) GetChain

func (u *UnaryRequestResult) GetChain() chains.Chain

func (*UnaryRequestResult) GetDuration

func (u *UnaryRequestResult) GetDuration() float64

func (*UnaryRequestResult) GetMethod

func (u *UnaryRequestResult) GetMethod() string

func (*UnaryRequestResult) GetReqKind

func (u *UnaryRequestResult) GetReqKind() RequestKind

func (*UnaryRequestResult) GetRespKind

func (u *UnaryRequestResult) GetRespKind() ResponseKind

func (*UnaryRequestResult) GetTimestamp

func (u *UnaryRequestResult) GetTimestamp() time.Time

func (*UnaryRequestResult) GetUpstreamId

func (u *UnaryRequestResult) GetUpstreamId() string

func (*UnaryRequestResult) IsSuccessfulRetry

func (u *UnaryRequestResult) IsSuccessfulRetry() bool

func (*UnaryRequestResult) WithDuration

func (u *UnaryRequestResult) WithDuration(duration float64) *UnaryRequestResult

func (*UnaryRequestResult) WithRespKindFromResponse

func (u *UnaryRequestResult) WithRespKindFromResponse(response ResponseHolder) *UnaryRequestResult

func (*UnaryRequestResult) WithSuccessfulRetry

func (u *UnaryRequestResult) WithSuccessfulRetry() *UnaryRequestResult

func (*UnaryRequestResult) WithUpstreamId

func (u *UnaryRequestResult) WithUpstreamId(upstreamId string) *UnaryRequestResult

type UnbanMethodUpstreamStateEvent

type UnbanMethodUpstreamStateEvent struct {
	Method string
}

func (*UnbanMethodUpstreamStateEvent) ProcessEvent

func (*UnbanMethodUpstreamStateEvent) Same

type UpstreamEvent

type UpstreamEvent struct {
	Id        string
	Chain     chains.Chain
	EventType UpstreamEventType
}

type UpstreamEventType

type UpstreamEventType interface {
	// contains filtered or unexported methods
}

type UpstreamJsonRpcRequest

type UpstreamJsonRpcRequest struct {
	// contains filtered or unexported fields
}

func NewInternalSubUpstreamJsonRpcRequest

func NewInternalSubUpstreamJsonRpcRequest(method string, params any, chain chains.Chain) (*UpstreamJsonRpcRequest, error)

func NewInternalUpstreamJsonRpcRequest

func NewInternalUpstreamJsonRpcRequest(method string, params any, chain chains.Chain) (*UpstreamJsonRpcRequest, error)

func NewStreamUpstreamJsonRpcRequest

func NewStreamUpstreamJsonRpcRequest(id string, realId json.RawMessage, method string, params json.RawMessage, specMethod *specs.Method) *UpstreamJsonRpcRequest

func NewUpstreamJsonRpcRequest

func NewUpstreamJsonRpcRequest(
	id string,
	realId json.RawMessage,
	method string,
	params json.RawMessage,
	isSub bool,
	specMethod *specs.Method,
) *UpstreamJsonRpcRequest

func NewUpstreamJsonRpcRequestWithSpecMethod

func NewUpstreamJsonRpcRequestWithSpecMethod(method string, params any, specMethod *specs.Method) (*UpstreamJsonRpcRequest, error)

func (*UpstreamJsonRpcRequest) Body

func (u *UpstreamJsonRpcRequest) Body() ([]byte, error)

func (*UpstreamJsonRpcRequest) Headers

func (u *UpstreamJsonRpcRequest) Headers() map[string]string

func (*UpstreamJsonRpcRequest) Id

func (*UpstreamJsonRpcRequest) IsStream

func (u *UpstreamJsonRpcRequest) IsStream() bool

func (*UpstreamJsonRpcRequest) IsSubscribe

func (u *UpstreamJsonRpcRequest) IsSubscribe() bool

func (*UpstreamJsonRpcRequest) Method

func (u *UpstreamJsonRpcRequest) Method() string

func (*UpstreamJsonRpcRequest) ModifyParams

func (u *UpstreamJsonRpcRequest) ModifyParams(ctx context.Context, newValue any)

func (*UpstreamJsonRpcRequest) ParseParams

func (*UpstreamJsonRpcRequest) RealId

func (u *UpstreamJsonRpcRequest) RealId() string

RealId returns the textual form of the JSON-RPC id actually placed on the wire (u.realId), unwrapped from the outer JSON quotes for string ids. This is what upstreams echo back in correlation headers (e.g. the QR quorum signature headers), and it differs from Id() which is nodecore's internal UUID tag used to route responses.

func (*UpstreamJsonRpcRequest) RequestHash

func (u *UpstreamJsonRpcRequest) RequestHash() string

func (*UpstreamJsonRpcRequest) RequestObserver

func (u *UpstreamJsonRpcRequest) RequestObserver() *RequestObserver

func (*UpstreamJsonRpcRequest) RequestType

func (u *UpstreamJsonRpcRequest) RequestType() RequestType

func (*UpstreamJsonRpcRequest) SpecMethod

func (u *UpstreamJsonRpcRequest) SpecMethod() *specs.Method

type UpstreamRestRequest

type UpstreamRestRequest struct {
	// contains filtered or unexported fields
}

func NewInternalUpstreamRestRequest

func NewInternalUpstreamRestRequest(httpMethod, path string, chain chains.Chain) *UpstreamRestRequest

func NewInternalUpstreamRestRequestWithQuery

func NewInternalUpstreamRestRequestWithQuery(httpMethod, path string, query map[string]string, chain chains.Chain) *UpstreamRestRequest

func NewUpstreamRestRequest

func NewUpstreamRestRequest(httpMethod, path string, body []byte) *UpstreamRestRequest

NewUpstreamRestRequest builds an external-facing REST request from an incoming HTTP call. Encodes method as "<VERB>#<path>" so the shared HttpConnector can split on MethodSeparator and forward the call to the upstream. Always initialises the observer to avoid a nil deref in ObserverConnector.

func (*UpstreamRestRequest) Body

func (u *UpstreamRestRequest) Body() ([]byte, error)

func (*UpstreamRestRequest) Headers

func (u *UpstreamRestRequest) Headers() map[string]string

func (*UpstreamRestRequest) Id

func (u *UpstreamRestRequest) Id() string

func (*UpstreamRestRequest) IsStream

func (u *UpstreamRestRequest) IsStream() bool

func (*UpstreamRestRequest) IsSubscribe

func (u *UpstreamRestRequest) IsSubscribe() bool

func (*UpstreamRestRequest) Method

func (u *UpstreamRestRequest) Method() string

func (*UpstreamRestRequest) ModifyParams

func (u *UpstreamRestRequest) ModifyParams(_ context.Context, _ any)

func (*UpstreamRestRequest) ParseParams

func (*UpstreamRestRequest) RequestHash

func (u *UpstreamRestRequest) RequestHash() string

func (*UpstreamRestRequest) RequestObserver

func (u *UpstreamRestRequest) RequestObserver() *RequestObserver

func (*UpstreamRestRequest) RequestType

func (u *UpstreamRestRequest) RequestType() RequestType

func (*UpstreamRestRequest) SpecMethod

func (u *UpstreamRestRequest) SpecMethod() *specs.Method

type UpstreamState

type UpstreamState struct {
	Status          AvailabilityStatus
	HeadData        Block
	UpstreamMethods methods.Methods
	Caps            mapset.Set[Cap]
	UpstreamIndex   string

	RateLimiterBudget   *ratelimiter.RateLimitBudget
	AutoTuneRateLimiter *ratelimiter.UpstreamAutoTune

	BlockInfo       *BlockInfo
	LowerBoundsInfo *LowerBoundInfo
	Labels          *Labels
}

func DefaultUpstreamState

func DefaultUpstreamState(upstreamMethods methods.Methods, caps mapset.Set[Cap], upstreamIndex string, rt *ratelimiter.RateLimitBudget, autoTuneRateLimiter *ratelimiter.UpstreamAutoTune) UpstreamState

type UpstreamSubscriptionResponse

type UpstreamSubscriptionResponse interface {
	ResponseChan() chan *WsResponse
	OpId() string
}

type ValidUpstreamEvent

type ValidUpstreamEvent struct{}

type ValidUpstreamStateEvent

type ValidUpstreamStateEvent struct{}

func (*ValidUpstreamStateEvent) ProcessEvent

func (v *ValidUpstreamStateEvent) ProcessEvent(state UpstreamState) UpstreamState

func (*ValidUpstreamStateEvent) Same

type WsJsonRpcResponse

type WsJsonRpcResponse struct {
	// contains filtered or unexported fields
}

func NewWsJsonRpcResponse

func NewWsJsonRpcResponse(id string, result []byte, error *ResponseError) *WsJsonRpcResponse

func (*WsJsonRpcResponse) EncodeResponse

func (w *WsJsonRpcResponse) EncodeResponse(realId []byte) io.Reader

func (*WsJsonRpcResponse) GetError

func (w *WsJsonRpcResponse) GetError() *ResponseError

func (*WsJsonRpcResponse) HasError

func (w *WsJsonRpcResponse) HasError() bool

func (*WsJsonRpcResponse) HasStream

func (w *WsJsonRpcResponse) HasStream() bool

func (*WsJsonRpcResponse) Id

func (w *WsJsonRpcResponse) Id() string

func (*WsJsonRpcResponse) ResponseCode

func (w *WsJsonRpcResponse) ResponseCode() int

func (*WsJsonRpcResponse) ResponseResult

func (w *WsJsonRpcResponse) ResponseResult() []byte

func (*WsJsonRpcResponse) ResponseResultString

func (w *WsJsonRpcResponse) ResponseResultString() (string, error)

type WsResponse

type WsResponse struct {
	Id      string
	SubId   string
	Message []byte
	Type    RequestType
	Error   *ResponseError
	Event   []byte
}

func ParseJsonRpcWsMessage

func ParseJsonRpcWsMessage(body []byte) *WsResponse

type ZeroBlock

type ZeroBlock = Block

Jump to

Keyboard shortcuts

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