Documentation
¶
Index ¶
- type Handler
- type Interceptor
- type NewHandler
- type Notifier
- type RoundTrip
- type RoundTrips
- func (r *RoundTrips) Add(request *jsonrpc.Request) (*RoundTrip, error)
- func (r *RoundTrips) CloseWithError(err error)
- func (r *RoundTrips) Get(index int) *RoundTrip
- func (r *RoundTrips) Match(id any) (*RoundTrip, error)
- func (r *RoundTrips) Remove(trip *RoundTrip) bool
- func (r *RoundTrips) Size() int
- type Sequencer
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interceptor ¶ added in v0.3.0
type Interceptor interface {
// Intercept is called after a response is received for a specific method (even if it's an error)
// It receives the context, original request, and the response
// If it returns a non-nil request, that request will be sent as a follow-up
// If it returns nil, no additional request will be sent
Intercept(ctx context.Context, request *jsonrpc.Request, response *jsonrpc.Response) (*jsonrpc.Request, error)
}
Interceptor defines an interface for intercepting JSON-RPC requests and responses for specific methods It allows for method-level post-processing of responses and optionally sending additional requests
type NewHandler ¶
NewHandler is a function that creates a new Handler
type Notifier ¶
type Notifier interface {
Notify(ctx context.Context, notification *jsonrpc.Notification) error
}
Notifier represents a notification handler
type RoundTrip ¶
type RoundTrip struct {
Request *jsonrpc.Request
Response *jsonrpc.Response
// contains filtered or unexported fields
}
RoundTrip represents a trip
func NewRoundTrip ¶
NewRoundTrip creates a new round trip
func (*RoundTrip) SetResponse ¶
SetResponse sets the response
type RoundTrips ¶
type RoundTrips struct {
Ring []*RoundTrip
// contains filtered or unexported fields
}
RoundTrips represents a collection of trips
func NewRoundTrips ¶
func NewRoundTrips(capacity int) *RoundTrips
NewRoundTrips creates a new round trips
func (*RoundTrips) Add ¶
func (r *RoundTrips) Add(request *jsonrpc.Request) (*RoundTrip, error)
Add adds a new trip
func (*RoundTrips) CloseWithError ¶
func (r *RoundTrips) CloseWithError(err error)
CloseWithError closes trips with error
func (*RoundTrips) Get ¶
func (r *RoundTrips) Get(index int) *RoundTrip
Get returns the trip at the given index
func (*RoundTrips) Match ¶
func (r *RoundTrips) Match(id any) (*RoundTrip, error)
Match matches a trip by id
func (*RoundTrips) Remove ¶ added in v0.25.1
func (r *RoundTrips) Remove(trip *RoundTrip) bool
Remove releases only the supplied trip. A response may already have matched it and its ID or slot may now belong to another request. Cleanup must never remove that replacement. It is safe to call Remove more than once or after CloseWithError; it does not complete the trip or change the response path.