message

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 21 Imported by: 2

Documentation

Overview

Package message defines message types and implements binary message transport for Accumulate API v3.

Message Routing

RoutedTransport can be configured to route messages to the appropriate network. However, some queries cannot be routed without a routing table. The following is an example of how the message client can be initialized with a routing table:

router := new(routing.MessageRouter)
transport := &message.RoutedTransport{
    Network: "MainNet",
    Dialer:  node.DialNetwork(),
    Router:  router,
}
client := &message.Client{Transport: transport}

ns, err := client.NetworkStatus(ctx, api.NetworkStatusOptions{})
if err != nil { panic(err) }

router.Router, err = routing.NewStaticRouter(ns.Routing, nil, nil)
if err != nil { panic(err) }

Index

Constants

This section is empty.

Variables

View Source
var ErrDeadline = stderr.New("deadline exceeded")

ErrDeadline is returned if a pipe read or write exceeds the deadline.

Functions

func AddressOf

func AddressOf(msg Message) multiaddr.Multiaddr

AddressOf returns the message's address if it is an Addressed.

func DuplexPipe

func DuplexPipe(ctx context.Context, opts ...pipeOpt) (p, q *pipe[Message])

DuplexPipe allocates a pair of duplex Message [Stream]s backed by a pair of unbuffered channels.

func DuplexPipeOf

func DuplexPipeOf[T any, PT valuePtr[T]](ctx context.Context, opts ...pipeOpt) (p, q *pipe[PT])

DuplexPipeOf allocates a pair of duplex [Stream]s of *T backed by a pair of unbuffered channels. *T must implement encoding.BinaryValue.

func Equal

func Equal(a, b Message) bool

Equal is used to compare the values of the union

func Pipe

func Pipe(ctx context.Context, opts ...pipeOpt) *pipe[Message]

Pipe allocates a simplex Message Stream backed by an unbuffered channel.

func PipeOf

func PipeOf[T any, PT valuePtr[T]](ctx context.Context, opts ...pipeOpt) *pipe[PT]

PipeOf allocates a simplex Stream of *T backed by an unbuffered channel. *T must implement encoding.BinaryValue.

func QueueDepth added in v1.2.10

func QueueDepth(depth int) pipeOpt

func RegisterMessageType

func RegisterMessageType[P msgStructPtr[T], T any](name string) error

RegisterMessageType registers a message type.

Types

type Addressed

type Addressed struct {
	Message Message       `json:"message,omitempty" form:"message" query:"message" validate:"required"`
	Address p2p.Multiaddr `json:"address,omitempty" form:"address" query:"address" validate:"required"`
	// contains filtered or unexported fields
}

func (*Addressed) Copy

func (v *Addressed) Copy() *Addressed

func (*Addressed) CopyAsInterface

func (v *Addressed) CopyAsInterface() interface{}

func (*Addressed) Equal

func (v *Addressed) Equal(u *Addressed) bool

func (*Addressed) IsValid

func (v *Addressed) IsValid() error

func (*Addressed) MarshalBinary

func (v *Addressed) MarshalBinary() ([]byte, error)

func (*Addressed) MarshalJSON

func (v *Addressed) MarshalJSON() ([]byte, error)

func (*Addressed) Type

func (*Addressed) Type() Type

func (*Addressed) UnmarshalBinary

func (v *Addressed) UnmarshalBinary(data []byte) error

func (*Addressed) UnmarshalBinaryFrom

func (v *Addressed) UnmarshalBinaryFrom(rd io.Reader) error

func (*Addressed) UnmarshalFieldsFrom

func (v *Addressed) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*Addressed) UnmarshalJSON

func (v *Addressed) UnmarshalJSON(data []byte) error

type AddressedClient added in v1.2.0

type AddressedClient struct {
	*Client
	Address multiaddr.Multiaddr
}

func (AddressedClient) ConsensusStatus added in v1.2.0

func (c AddressedClient) ConsensusStatus(ctx context.Context, opts api.ConsensusStatusOptions) (*api.ConsensusStatus, error)

ConsensusStatus implements api.NodeService.ConsensusStatus.

func (AddressedClient) Faucet added in v1.2.0

func (c AddressedClient) Faucet(ctx context.Context, account *url.URL, opts api.FaucetOptions) (*api.Submission, error)

Faucet implements api.Faucet.Faucet.

func (AddressedClient) FindService added in v1.2.0

func (c AddressedClient) FindService(ctx context.Context, opts api.FindServiceOptions) ([]*api.FindServiceResult, error)

FindService implements api.NodeService.FindService.

func (AddressedClient) Metrics added in v1.2.0

func (c AddressedClient) Metrics(ctx context.Context, opts api.MetricsOptions) (*api.Metrics, error)

Metrics implements api.MetricsService.Metrics.

func (AddressedClient) NetworkStatus added in v1.2.0

func (c AddressedClient) NetworkStatus(ctx context.Context, opts api.NetworkStatusOptions) (*api.NetworkStatus, error)

NetworkStatus implements api.NetworkService.NetworkStatus.

func (AddressedClient) NodeInfo added in v1.2.0

func (c AddressedClient) NodeInfo(ctx context.Context, opts api.NodeInfoOptions) (*api.NodeInfo, error)

NodeInfo implements api.NodeService.NodeInfo.

func (AddressedClient) Private added in v1.2.0

func (c AddressedClient) Private() private.Sequencer

Private returns a PrivateClient.

func (AddressedClient) Query added in v1.2.0

func (c AddressedClient) Query(ctx context.Context, scope *url.URL, query api.Query) (api.Record, error)

Query implements api.Querier.Query.

func (AddressedClient) Submit added in v1.2.0

func (c AddressedClient) Submit(ctx context.Context, envelope *messaging.Envelope, opts api.SubmitOptions) ([]*api.Submission, error)

Submit implements api.Submitter.Submit.

func (AddressedClient) Validate added in v1.2.0

func (c AddressedClient) Validate(ctx context.Context, envelope *messaging.Envelope, opts api.ValidateOptions) ([]*api.Submission, error)

Validate implements api.Validator.Validate.

type Client

type Client struct {
	Transport Transport
}

Client is a binary message client for API v3.

func (*Client) ConsensusStatus

func (c *Client) ConsensusStatus(ctx context.Context, opts api.ConsensusStatusOptions) (*api.ConsensusStatus, error)

ConsensusStatus implements api.NodeService.ConsensusStatus.

func (*Client) Faucet

func (c *Client) Faucet(ctx context.Context, account *url.URL, opts api.FaucetOptions) (*api.Submission, error)

Faucet implements api.Faucet.Faucet.

func (*Client) FindService

func (c *Client) FindService(ctx context.Context, opts api.FindServiceOptions) ([]*api.FindServiceResult, error)

FindService implements api.NodeService.FindService.

func (*Client) ForAddress added in v1.2.0

func (c *Client) ForAddress(addr multiaddr.Multiaddr) AddressedClient

func (*Client) ForPeer added in v1.2.0

func (c *Client) ForPeer(peer peer.ID) AddressedClient

func (*Client) Metrics

func (c *Client) Metrics(ctx context.Context, opts api.MetricsOptions) (*api.Metrics, error)

Metrics implements api.MetricsService.Metrics.

func (*Client) NetworkStatus

func (c *Client) NetworkStatus(ctx context.Context, opts api.NetworkStatusOptions) (*api.NetworkStatus, error)

NetworkStatus implements api.NetworkService.NetworkStatus.

func (*Client) NodeInfo

func (c *Client) NodeInfo(ctx context.Context, opts api.NodeInfoOptions) (*api.NodeInfo, error)

NodeInfo implements api.NodeService.NodeInfo.

func (*Client) Private

func (c *Client) Private() private.Sequencer

Private returns a PrivateClient.

func (*Client) Query

func (c *Client) Query(ctx context.Context, scope *url.URL, query api.Query) (api.Record, error)

Query implements api.Querier.Query.

func (*Client) Submit

func (c *Client) Submit(ctx context.Context, envelope *messaging.Envelope, opts api.SubmitOptions) ([]*api.Submission, error)

Submit implements api.Submitter.Submit.

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, opts api.SubscribeOptions) (<-chan api.Event, error)

func (*Client) Validate

func (c *Client) Validate(ctx context.Context, envelope *messaging.Envelope, opts api.ValidateOptions) ([]*api.Submission, error)

Validate implements api.Validator.Validate.

type ConsensusService

type ConsensusService struct {
	api.ConsensusService
}

ConsensusService forwards [NodeStatusRequest]s to a api.ConsensusService.

type ConsensusStatusRequest

type ConsensusStatusRequest struct {
	api.ConsensusStatusOptions
	// contains filtered or unexported fields
}

func (*ConsensusStatusRequest) Copy

func (*ConsensusStatusRequest) CopyAsInterface

func (v *ConsensusStatusRequest) CopyAsInterface() interface{}

func (*ConsensusStatusRequest) Equal

func (*ConsensusStatusRequest) IsValid

func (v *ConsensusStatusRequest) IsValid() error

func (*ConsensusStatusRequest) MarshalBinary

func (v *ConsensusStatusRequest) MarshalBinary() ([]byte, error)

func (*ConsensusStatusRequest) MarshalJSON

func (v *ConsensusStatusRequest) MarshalJSON() ([]byte, error)

func (*ConsensusStatusRequest) Type

func (*ConsensusStatusRequest) Type() Type

func (*ConsensusStatusRequest) UnmarshalBinary

func (v *ConsensusStatusRequest) UnmarshalBinary(data []byte) error

func (*ConsensusStatusRequest) UnmarshalBinaryFrom

func (v *ConsensusStatusRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*ConsensusStatusRequest) UnmarshalFieldsFrom

func (v *ConsensusStatusRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*ConsensusStatusRequest) UnmarshalJSON

func (v *ConsensusStatusRequest) UnmarshalJSON(data []byte) error

type ConsensusStatusResponse

type ConsensusStatusResponse struct {
	Value *api.ConsensusStatus `json:"value,omitempty" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*ConsensusStatusResponse) Copy

func (*ConsensusStatusResponse) CopyAsInterface

func (v *ConsensusStatusResponse) CopyAsInterface() interface{}

func (*ConsensusStatusResponse) Equal

func (*ConsensusStatusResponse) IsValid

func (v *ConsensusStatusResponse) IsValid() error

func (*ConsensusStatusResponse) MarshalBinary

func (v *ConsensusStatusResponse) MarshalBinary() ([]byte, error)

func (*ConsensusStatusResponse) MarshalJSON

func (v *ConsensusStatusResponse) MarshalJSON() ([]byte, error)

func (*ConsensusStatusResponse) Type

func (*ConsensusStatusResponse) Type() Type

func (*ConsensusStatusResponse) UnmarshalBinary

func (v *ConsensusStatusResponse) UnmarshalBinary(data []byte) error

func (*ConsensusStatusResponse) UnmarshalBinaryFrom

func (v *ConsensusStatusResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*ConsensusStatusResponse) UnmarshalFieldsFrom

func (v *ConsensusStatusResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*ConsensusStatusResponse) UnmarshalJSON

func (v *ConsensusStatusResponse) UnmarshalJSON(data []byte) error

type Dialer

type Dialer interface {
	// Dial returns a stream for the given address. The caller must cancel the
	// context once the stream is no longer needed. The dialer is responsible
	// for cleaning up the stream once the context has been canceled.
	Dial(context.Context, multiaddr.Multiaddr) (Stream, error)
}

A Dialer dials an address, returning a message stream.

func BatchDialer

func BatchDialer(ctx context.Context, dialer Dialer) Dialer

BatchDialer returns a dialer that reuses streams. BatchDialer ignores the contexts passed to Dial and BadDial and uses the context passed to BatchDialer instead. Thus the context must be canceled to close all the dialed streams.

If the dialer is a MultiDialer, calls to BadDial will be forwarded.

type ErrorResponse

type ErrorResponse struct {
	Error *errors2.Error `json:"error,omitempty" form:"error" query:"error" validate:"required"`
	// contains filtered or unexported fields
}

func (*ErrorResponse) Copy

func (v *ErrorResponse) Copy() *ErrorResponse

func (*ErrorResponse) CopyAsInterface

func (v *ErrorResponse) CopyAsInterface() interface{}

func (*ErrorResponse) Equal

func (v *ErrorResponse) Equal(u *ErrorResponse) bool

func (*ErrorResponse) IsValid

func (v *ErrorResponse) IsValid() error

func (*ErrorResponse) MarshalBinary

func (v *ErrorResponse) MarshalBinary() ([]byte, error)

func (*ErrorResponse) MarshalJSON

func (v *ErrorResponse) MarshalJSON() ([]byte, error)

func (*ErrorResponse) Type

func (*ErrorResponse) Type() Type

func (*ErrorResponse) UnmarshalBinary

func (v *ErrorResponse) UnmarshalBinary(data []byte) error

func (*ErrorResponse) UnmarshalBinaryFrom

func (v *ErrorResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*ErrorResponse) UnmarshalFieldsFrom

func (v *ErrorResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*ErrorResponse) UnmarshalJSON

func (v *ErrorResponse) UnmarshalJSON(data []byte) error

type EventMessage

type EventMessage struct {
	Value []api.Event `json:"value" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*EventMessage) Copy

func (v *EventMessage) Copy() *EventMessage

func (*EventMessage) CopyAsInterface

func (v *EventMessage) CopyAsInterface() interface{}

func (*EventMessage) Equal

func (v *EventMessage) Equal(u *EventMessage) bool

func (*EventMessage) IsValid

func (v *EventMessage) IsValid() error

func (*EventMessage) MarshalBinary

func (v *EventMessage) MarshalBinary() ([]byte, error)

func (*EventMessage) MarshalJSON

func (v *EventMessage) MarshalJSON() ([]byte, error)

func (*EventMessage) Type

func (*EventMessage) Type() Type

func (*EventMessage) UnmarshalBinary

func (v *EventMessage) UnmarshalBinary(data []byte) error

func (*EventMessage) UnmarshalBinaryFrom

func (v *EventMessage) UnmarshalBinaryFrom(rd io.Reader) error

func (*EventMessage) UnmarshalFieldsFrom

func (v *EventMessage) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*EventMessage) UnmarshalJSON

func (v *EventMessage) UnmarshalJSON(data []byte) error

type EventService

type EventService struct {
	api.EventService
}

func (EventService) Subscribe

func (s EventService) Subscribe(c *call[*SubscribeRequest])

type Faucet

type Faucet struct {
	api.Faucet
}

Faucet forwards [FaucetRequest]s to a api.Faucet.

type FaucetRequest

type FaucetRequest struct {
	Account *url.URL `json:"account,omitempty" form:"account" query:"account" validate:"required"`
	api.FaucetOptions
	// contains filtered or unexported fields
}

func (*FaucetRequest) Copy

func (v *FaucetRequest) Copy() *FaucetRequest

func (*FaucetRequest) CopyAsInterface

func (v *FaucetRequest) CopyAsInterface() interface{}

func (*FaucetRequest) Equal

func (v *FaucetRequest) Equal(u *FaucetRequest) bool

func (*FaucetRequest) IsValid

func (v *FaucetRequest) IsValid() error

func (*FaucetRequest) MarshalBinary

func (v *FaucetRequest) MarshalBinary() ([]byte, error)

func (*FaucetRequest) MarshalJSON

func (v *FaucetRequest) MarshalJSON() ([]byte, error)

func (*FaucetRequest) Type

func (*FaucetRequest) Type() Type

func (*FaucetRequest) UnmarshalBinary

func (v *FaucetRequest) UnmarshalBinary(data []byte) error

func (*FaucetRequest) UnmarshalBinaryFrom

func (v *FaucetRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*FaucetRequest) UnmarshalFieldsFrom

func (v *FaucetRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*FaucetRequest) UnmarshalJSON

func (v *FaucetRequest) UnmarshalJSON(data []byte) error

type FaucetResponse

type FaucetResponse struct {
	Value *api.Submission `json:"value,omitempty" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*FaucetResponse) Copy

func (v *FaucetResponse) Copy() *FaucetResponse

func (*FaucetResponse) CopyAsInterface

func (v *FaucetResponse) CopyAsInterface() interface{}

func (*FaucetResponse) Equal

func (v *FaucetResponse) Equal(u *FaucetResponse) bool

func (*FaucetResponse) IsValid

func (v *FaucetResponse) IsValid() error

func (*FaucetResponse) MarshalBinary

func (v *FaucetResponse) MarshalBinary() ([]byte, error)

func (*FaucetResponse) MarshalJSON

func (v *FaucetResponse) MarshalJSON() ([]byte, error)

func (*FaucetResponse) Type

func (*FaucetResponse) Type() Type

func (*FaucetResponse) UnmarshalBinary

func (v *FaucetResponse) UnmarshalBinary(data []byte) error

func (*FaucetResponse) UnmarshalBinaryFrom

func (v *FaucetResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*FaucetResponse) UnmarshalFieldsFrom

func (v *FaucetResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*FaucetResponse) UnmarshalJSON

func (v *FaucetResponse) UnmarshalJSON(data []byte) error

type FindServiceRequest

type FindServiceRequest struct {
	api.FindServiceOptions
	// contains filtered or unexported fields
}

func (*FindServiceRequest) Copy

func (*FindServiceRequest) CopyAsInterface

func (v *FindServiceRequest) CopyAsInterface() interface{}

func (*FindServiceRequest) Equal

func (*FindServiceRequest) IsValid

func (v *FindServiceRequest) IsValid() error

func (*FindServiceRequest) MarshalBinary

func (v *FindServiceRequest) MarshalBinary() ([]byte, error)

func (*FindServiceRequest) MarshalJSON

func (v *FindServiceRequest) MarshalJSON() ([]byte, error)

func (*FindServiceRequest) Type

func (*FindServiceRequest) Type() Type

func (*FindServiceRequest) UnmarshalBinary

func (v *FindServiceRequest) UnmarshalBinary(data []byte) error

func (*FindServiceRequest) UnmarshalBinaryFrom

func (v *FindServiceRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*FindServiceRequest) UnmarshalFieldsFrom

func (v *FindServiceRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*FindServiceRequest) UnmarshalJSON

func (v *FindServiceRequest) UnmarshalJSON(data []byte) error

type FindServiceResponse

type FindServiceResponse struct {
	Value []*api.FindServiceResult `json:"value" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*FindServiceResponse) Copy

func (*FindServiceResponse) CopyAsInterface

func (v *FindServiceResponse) CopyAsInterface() interface{}

func (*FindServiceResponse) Equal

func (*FindServiceResponse) IsValid

func (v *FindServiceResponse) IsValid() error

func (*FindServiceResponse) MarshalBinary

func (v *FindServiceResponse) MarshalBinary() ([]byte, error)

func (*FindServiceResponse) MarshalJSON

func (v *FindServiceResponse) MarshalJSON() ([]byte, error)

func (*FindServiceResponse) Type

func (*FindServiceResponse) Type() Type

func (*FindServiceResponse) UnmarshalBinary

func (v *FindServiceResponse) UnmarshalBinary(data []byte) error

func (*FindServiceResponse) UnmarshalBinaryFrom

func (v *FindServiceResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*FindServiceResponse) UnmarshalFieldsFrom

func (v *FindServiceResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*FindServiceResponse) UnmarshalJSON

func (v *FindServiceResponse) UnmarshalJSON(data []byte) error

type Handler

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

Handler handles message streams.

func NewHandler

func NewHandler(services ...Service) (*Handler, error)

NewHandler constructs a new Handler with the given list of services. NewHandler only returns an error if more than one service attempts to register a method for the same request type.

func (*Handler) Handle

func (h *Handler) Handle(s Stream)

Handle handles a message stream. Handle is safe to call from a goroutine.

func (*Handler) Register added in v1.2.10

func (h *Handler) Register(services ...Service) error

type Message

type Message interface {
	encoding.UnionValue
	Type() Type
}

A Message is a binary message used to transport API v3 RPCs.

func Copy

func Copy(v Message) Message

Copy copies a Message.

func New

func New(typ Type) (Message, error)

New creates a new Message for the specified Type.

func Unmarshal

func Unmarshal(data []byte) (Message, error)

Unmarshal unmarshals a Message.

func UnmarshalFrom

func UnmarshalFrom(rd io.Reader) (Message, error)

UnmarshalFrom unmarshals a Message.

func UnmarshalJSON

func UnmarshalJSON(data []byte) (Message, error)

UnmarshalJson unmarshals a Message.

type MetricsRequest

type MetricsRequest struct {
	api.MetricsOptions
	// contains filtered or unexported fields
}

func (*MetricsRequest) Copy

func (v *MetricsRequest) Copy() *MetricsRequest

func (*MetricsRequest) CopyAsInterface

func (v *MetricsRequest) CopyAsInterface() interface{}

func (*MetricsRequest) Equal

func (v *MetricsRequest) Equal(u *MetricsRequest) bool

func (*MetricsRequest) IsValid

func (v *MetricsRequest) IsValid() error

func (*MetricsRequest) MarshalBinary

func (v *MetricsRequest) MarshalBinary() ([]byte, error)

func (*MetricsRequest) MarshalJSON

func (v *MetricsRequest) MarshalJSON() ([]byte, error)

func (*MetricsRequest) Type

func (*MetricsRequest) Type() Type

func (*MetricsRequest) UnmarshalBinary

func (v *MetricsRequest) UnmarshalBinary(data []byte) error

func (*MetricsRequest) UnmarshalBinaryFrom

func (v *MetricsRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*MetricsRequest) UnmarshalFieldsFrom

func (v *MetricsRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*MetricsRequest) UnmarshalJSON

func (v *MetricsRequest) UnmarshalJSON(data []byte) error

type MetricsResponse

type MetricsResponse struct {
	Value *api.Metrics `json:"value,omitempty" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*MetricsResponse) Copy

func (v *MetricsResponse) Copy() *MetricsResponse

func (*MetricsResponse) CopyAsInterface

func (v *MetricsResponse) CopyAsInterface() interface{}

func (*MetricsResponse) Equal

func (v *MetricsResponse) Equal(u *MetricsResponse) bool

func (*MetricsResponse) IsValid

func (v *MetricsResponse) IsValid() error

func (*MetricsResponse) MarshalBinary

func (v *MetricsResponse) MarshalBinary() ([]byte, error)

func (*MetricsResponse) MarshalJSON

func (v *MetricsResponse) MarshalJSON() ([]byte, error)

func (*MetricsResponse) Type

func (*MetricsResponse) Type() Type

func (*MetricsResponse) UnmarshalBinary

func (v *MetricsResponse) UnmarshalBinary(data []byte) error

func (*MetricsResponse) UnmarshalBinaryFrom

func (v *MetricsResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*MetricsResponse) UnmarshalFieldsFrom

func (v *MetricsResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*MetricsResponse) UnmarshalJSON

func (v *MetricsResponse) UnmarshalJSON(data []byte) error

type MetricsService

type MetricsService struct {
	api.MetricsService
}

MetricsService forwards [MetricsRequest]s to a api.MetricsService.

type MultiDialer

type MultiDialer interface {
	Dialer

	// BadDial is used by Transport to report stream errors. The address will be
	// the same address passed to Dial, and the stream will be the exact value
	// returned from Dial.
	BadDial(context.Context, multiaddr.Multiaddr, Stream, error) bool
}

MultiDialer is a dialer that accepts error reports and may be called multiple times for one request.

type NetworkService

type NetworkService struct {
	api.NetworkService
}

NetworkService forwards [NetworkStatusRequest]s to a api.NetworkService.

type NetworkStatusRequest

type NetworkStatusRequest struct {
	api.NetworkStatusOptions
	// contains filtered or unexported fields
}

func (*NetworkStatusRequest) Copy

func (*NetworkStatusRequest) CopyAsInterface

func (v *NetworkStatusRequest) CopyAsInterface() interface{}

func (*NetworkStatusRequest) Equal

func (*NetworkStatusRequest) IsValid

func (v *NetworkStatusRequest) IsValid() error

func (*NetworkStatusRequest) MarshalBinary

func (v *NetworkStatusRequest) MarshalBinary() ([]byte, error)

func (*NetworkStatusRequest) MarshalJSON

func (v *NetworkStatusRequest) MarshalJSON() ([]byte, error)

func (*NetworkStatusRequest) Type

func (*NetworkStatusRequest) Type() Type

func (*NetworkStatusRequest) UnmarshalBinary

func (v *NetworkStatusRequest) UnmarshalBinary(data []byte) error

func (*NetworkStatusRequest) UnmarshalBinaryFrom

func (v *NetworkStatusRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*NetworkStatusRequest) UnmarshalFieldsFrom

func (v *NetworkStatusRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*NetworkStatusRequest) UnmarshalJSON

func (v *NetworkStatusRequest) UnmarshalJSON(data []byte) error

type NetworkStatusResponse

type NetworkStatusResponse struct {
	Value *api.NetworkStatus `json:"value,omitempty" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*NetworkStatusResponse) Copy

func (*NetworkStatusResponse) CopyAsInterface

func (v *NetworkStatusResponse) CopyAsInterface() interface{}

func (*NetworkStatusResponse) Equal

func (*NetworkStatusResponse) IsValid

func (v *NetworkStatusResponse) IsValid() error

func (*NetworkStatusResponse) MarshalBinary

func (v *NetworkStatusResponse) MarshalBinary() ([]byte, error)

func (*NetworkStatusResponse) MarshalJSON

func (v *NetworkStatusResponse) MarshalJSON() ([]byte, error)

func (*NetworkStatusResponse) Type

func (*NetworkStatusResponse) Type() Type

func (*NetworkStatusResponse) UnmarshalBinary

func (v *NetworkStatusResponse) UnmarshalBinary(data []byte) error

func (*NetworkStatusResponse) UnmarshalBinaryFrom

func (v *NetworkStatusResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*NetworkStatusResponse) UnmarshalFieldsFrom

func (v *NetworkStatusResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*NetworkStatusResponse) UnmarshalJSON

func (v *NetworkStatusResponse) UnmarshalJSON(data []byte) error

type NodeInfoRequest

type NodeInfoRequest struct {
	api.NodeInfoOptions
	// contains filtered or unexported fields
}

func (*NodeInfoRequest) Copy

func (v *NodeInfoRequest) Copy() *NodeInfoRequest

func (*NodeInfoRequest) CopyAsInterface

func (v *NodeInfoRequest) CopyAsInterface() interface{}

func (*NodeInfoRequest) Equal

func (v *NodeInfoRequest) Equal(u *NodeInfoRequest) bool

func (*NodeInfoRequest) IsValid

func (v *NodeInfoRequest) IsValid() error

func (*NodeInfoRequest) MarshalBinary

func (v *NodeInfoRequest) MarshalBinary() ([]byte, error)

func (*NodeInfoRequest) MarshalJSON

func (v *NodeInfoRequest) MarshalJSON() ([]byte, error)

func (*NodeInfoRequest) Type

func (*NodeInfoRequest) Type() Type

func (*NodeInfoRequest) UnmarshalBinary

func (v *NodeInfoRequest) UnmarshalBinary(data []byte) error

func (*NodeInfoRequest) UnmarshalBinaryFrom

func (v *NodeInfoRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*NodeInfoRequest) UnmarshalFieldsFrom

func (v *NodeInfoRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*NodeInfoRequest) UnmarshalJSON

func (v *NodeInfoRequest) UnmarshalJSON(data []byte) error

type NodeInfoResponse

type NodeInfoResponse struct {
	Value *api.NodeInfo `json:"value,omitempty" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*NodeInfoResponse) Copy

func (*NodeInfoResponse) CopyAsInterface

func (v *NodeInfoResponse) CopyAsInterface() interface{}

func (*NodeInfoResponse) Equal

func (v *NodeInfoResponse) Equal(u *NodeInfoResponse) bool

func (*NodeInfoResponse) IsValid

func (v *NodeInfoResponse) IsValid() error

func (*NodeInfoResponse) MarshalBinary

func (v *NodeInfoResponse) MarshalBinary() ([]byte, error)

func (*NodeInfoResponse) MarshalJSON

func (v *NodeInfoResponse) MarshalJSON() ([]byte, error)

func (*NodeInfoResponse) Type

func (*NodeInfoResponse) Type() Type

func (*NodeInfoResponse) UnmarshalBinary

func (v *NodeInfoResponse) UnmarshalBinary(data []byte) error

func (*NodeInfoResponse) UnmarshalBinaryFrom

func (v *NodeInfoResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*NodeInfoResponse) UnmarshalFieldsFrom

func (v *NodeInfoResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*NodeInfoResponse) UnmarshalJSON

func (v *NodeInfoResponse) UnmarshalJSON(data []byte) error

type NodeService

type NodeService struct {
	api.NodeService
}

NodeService forwards [NodeStatusRequest]s to a api.NodeService.

type PrivateClient

type PrivateClient AddressedClient

PrivateClient is a binary message transport client for private API v3 services.

func (PrivateClient) Sequence

func (c PrivateClient) Sequence(ctx context.Context, src, dst *url.URL, num uint64, opts private.SequenceOptions) (*api.MessageRecord[messaging.Message], error)

Sequence implements private.Sequencer.Sequence.

type PrivateSequenceRequest

type PrivateSequenceRequest struct {
	Source         *url.URL `json:"source,omitempty" form:"source" query:"source" validate:"required"`
	Destination    *url.URL `json:"destination,omitempty" form:"destination" query:"destination" validate:"required"`
	SequenceNumber uint64   `json:"sequenceNumber,omitempty" form:"sequenceNumber" query:"sequenceNumber" validate:"required"`
	private.SequenceOptions
	// contains filtered or unexported fields
}

func (*PrivateSequenceRequest) Copy

func (*PrivateSequenceRequest) CopyAsInterface

func (v *PrivateSequenceRequest) CopyAsInterface() interface{}

func (*PrivateSequenceRequest) Equal

func (*PrivateSequenceRequest) IsValid

func (v *PrivateSequenceRequest) IsValid() error

func (*PrivateSequenceRequest) MarshalBinary

func (v *PrivateSequenceRequest) MarshalBinary() ([]byte, error)

func (*PrivateSequenceRequest) MarshalJSON

func (v *PrivateSequenceRequest) MarshalJSON() ([]byte, error)

func (*PrivateSequenceRequest) Type

func (*PrivateSequenceRequest) Type() Type

func (*PrivateSequenceRequest) UnmarshalBinary

func (v *PrivateSequenceRequest) UnmarshalBinary(data []byte) error

func (*PrivateSequenceRequest) UnmarshalBinaryFrom

func (v *PrivateSequenceRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*PrivateSequenceRequest) UnmarshalFieldsFrom

func (v *PrivateSequenceRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*PrivateSequenceRequest) UnmarshalJSON

func (v *PrivateSequenceRequest) UnmarshalJSON(data []byte) error

type PrivateSequenceResponse

type PrivateSequenceResponse struct {
	Value *api.MessageRecord[messaging.Message] `json:"value,omitempty" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*PrivateSequenceResponse) Copy

func (*PrivateSequenceResponse) CopyAsInterface

func (v *PrivateSequenceResponse) CopyAsInterface() interface{}

func (*PrivateSequenceResponse) Equal

func (*PrivateSequenceResponse) IsValid

func (v *PrivateSequenceResponse) IsValid() error

func (*PrivateSequenceResponse) MarshalBinary

func (v *PrivateSequenceResponse) MarshalBinary() ([]byte, error)

func (*PrivateSequenceResponse) MarshalJSON

func (v *PrivateSequenceResponse) MarshalJSON() ([]byte, error)

func (*PrivateSequenceResponse) Type

func (*PrivateSequenceResponse) Type() Type

func (*PrivateSequenceResponse) UnmarshalBinary

func (v *PrivateSequenceResponse) UnmarshalBinary(data []byte) error

func (*PrivateSequenceResponse) UnmarshalBinaryFrom

func (v *PrivateSequenceResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*PrivateSequenceResponse) UnmarshalFieldsFrom

func (v *PrivateSequenceResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*PrivateSequenceResponse) UnmarshalJSON

func (v *PrivateSequenceResponse) UnmarshalJSON(data []byte) error

type Querier

type Querier struct {
	api.Querier
}

Querier forwards [QueryRequest]s to a api.Querier.

type QueryRequest

type QueryRequest struct {
	Scope *url.URL  `json:"scope,omitempty" form:"scope" query:"scope" validate:"required"`
	Query api.Query `json:"query,omitempty" form:"query" query:"query"`
	// contains filtered or unexported fields
}

func (*QueryRequest) Copy

func (v *QueryRequest) Copy() *QueryRequest

func (*QueryRequest) CopyAsInterface

func (v *QueryRequest) CopyAsInterface() interface{}

func (*QueryRequest) Equal

func (v *QueryRequest) Equal(u *QueryRequest) bool

func (*QueryRequest) IsValid

func (v *QueryRequest) IsValid() error

func (*QueryRequest) MarshalBinary

func (v *QueryRequest) MarshalBinary() ([]byte, error)

func (*QueryRequest) MarshalJSON

func (v *QueryRequest) MarshalJSON() ([]byte, error)

func (*QueryRequest) Type

func (*QueryRequest) Type() Type

func (*QueryRequest) UnmarshalBinary

func (v *QueryRequest) UnmarshalBinary(data []byte) error

func (*QueryRequest) UnmarshalBinaryFrom

func (v *QueryRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*QueryRequest) UnmarshalFieldsFrom

func (v *QueryRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*QueryRequest) UnmarshalJSON

func (v *QueryRequest) UnmarshalJSON(data []byte) error

type RecordResponse

type RecordResponse struct {
	Value api.Record `json:"value,omitempty" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*RecordResponse) Copy

func (v *RecordResponse) Copy() *RecordResponse

func (*RecordResponse) CopyAsInterface

func (v *RecordResponse) CopyAsInterface() interface{}

func (*RecordResponse) Equal

func (v *RecordResponse) Equal(u *RecordResponse) bool

func (*RecordResponse) IsValid

func (v *RecordResponse) IsValid() error

func (*RecordResponse) MarshalBinary

func (v *RecordResponse) MarshalBinary() ([]byte, error)

func (*RecordResponse) MarshalJSON

func (v *RecordResponse) MarshalJSON() ([]byte, error)

func (*RecordResponse) Type

func (*RecordResponse) Type() Type

func (*RecordResponse) UnmarshalBinary

func (v *RecordResponse) UnmarshalBinary(data []byte) error

func (*RecordResponse) UnmarshalBinaryFrom

func (v *RecordResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*RecordResponse) UnmarshalFieldsFrom

func (v *RecordResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*RecordResponse) UnmarshalJSON

func (v *RecordResponse) UnmarshalJSON(data []byte) error

type ResponseCallback

type ResponseCallback func(res, req Message) error

type RoutedTransport

type RoutedTransport struct {
	// Network to query. Some queries are only available when a network is
	// specified.
	Network string

	// Dialer dials connections to a given address. The client indicates that
	// the stream can be closed by canceling the context passed to Dial.
	Dialer Dialer

	// Router determines the address a message should be routed to.
	Router Router

	// Attempts is the number of connection attempts to make.
	Attempts int
}

RoutedTransport is a Transport implementation that routes messages to the appropriate service.

func (*RoutedTransport) OpenStream

func (c *RoutedTransport) OpenStream(ctx context.Context, request Message, callback ResponseCallback) (Stream, error)

func (*RoutedTransport) RoundTrip

func (c *RoutedTransport) RoundTrip(ctx context.Context, requests []Message, callback ResponseCallback) error

RoundTrip routes each requests and executes a round-trip call. If there are no transport errors, RoundTrip will only dial each address once. If multiple requests route to the same address, the first request will dial a stream and subsequent requests to that address will reuse the existing stream.

Certain types of requests, such as transaction hash searches, are fanned out to every partition. If requests contains such a request, RoundTrip queries the network for a list of partitions, submits the request to every partition, and aggregates the responses into a single response.

RoundTrip is a low-level interface not intended for general use.

roundTrip routes each request, dials a stream, and executes a round-trip call, sending the request and waiting for the response. roundTrip calls the callback for each request-response pair. The callback may be called more than once if there are transport errors.

roundTrip maintains a stream dictionary, which is passed to dial. Since dial will reuse an existing stream when appropriate, if there are no transport errors, roundTrip will only dial each address once. If multiple requests route to the same address, the first request will dial a stream and subsequent requests to that address will reuse the existing stream.

type Router

type Router interface {
	Route(Message) (multiaddr.Multiaddr, error)
}

A Router determines the address a message should be routed to.

type Sequencer

type Sequencer struct {
	private.Sequencer
}

Sequencer forwards [PrivateSequenceRequest]s to a private.Sequencer.

type Service

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

A Service is implements binary message transport for an API v3 service.

type Stream

type Stream = StreamOf[Message]

Stream is a stream of [Message]s.

func NewStream

func NewStream(raw io.ReadWriter) Stream

NewStream returns a Stream of [Message]s wrapping the underlying io.ReadWriter.

Messages are marshalled and unmarshalled as binary prefixed with the byte count.

type StreamOf

type StreamOf[T any] interface {
	// Read reads the next value from the stream.
	Read() (T, error)

	// Write writes a value to the stream.
	Write(T) error
}

Stream is a stream of T.

func NewStreamOf

func NewStreamOf[T any, PT valuePtr[T]](raw io.ReadWriter) StreamOf[PT]

NewStreamOf returns a [StreamOf[T]] wrapping the underlying io.ReadWriter. A pointer to T must implement encoding.BinaryValue.

Values are marshalled and unmarshalled as binary prefixed with the byte count.

type SubmitRequest

type SubmitRequest struct {
	Envelope *messaging.Envelope `json:"envelope,omitempty" form:"envelope" query:"envelope" validate:"required"`
	api.SubmitOptions
	// contains filtered or unexported fields
}

func (*SubmitRequest) Copy

func (v *SubmitRequest) Copy() *SubmitRequest

func (*SubmitRequest) CopyAsInterface

func (v *SubmitRequest) CopyAsInterface() interface{}

func (*SubmitRequest) Equal

func (v *SubmitRequest) Equal(u *SubmitRequest) bool

func (*SubmitRequest) IsValid

func (v *SubmitRequest) IsValid() error

func (*SubmitRequest) MarshalBinary

func (v *SubmitRequest) MarshalBinary() ([]byte, error)

func (*SubmitRequest) MarshalJSON

func (v *SubmitRequest) MarshalJSON() ([]byte, error)

func (*SubmitRequest) Type

func (*SubmitRequest) Type() Type

func (*SubmitRequest) UnmarshalBinary

func (v *SubmitRequest) UnmarshalBinary(data []byte) error

func (*SubmitRequest) UnmarshalBinaryFrom

func (v *SubmitRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*SubmitRequest) UnmarshalFieldsFrom

func (v *SubmitRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*SubmitRequest) UnmarshalJSON

func (v *SubmitRequest) UnmarshalJSON(data []byte) error

type SubmitResponse

type SubmitResponse struct {
	Value []*api.Submission `json:"value" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*SubmitResponse) Copy

func (v *SubmitResponse) Copy() *SubmitResponse

func (*SubmitResponse) CopyAsInterface

func (v *SubmitResponse) CopyAsInterface() interface{}

func (*SubmitResponse) Equal

func (v *SubmitResponse) Equal(u *SubmitResponse) bool

func (*SubmitResponse) IsValid

func (v *SubmitResponse) IsValid() error

func (*SubmitResponse) MarshalBinary

func (v *SubmitResponse) MarshalBinary() ([]byte, error)

func (*SubmitResponse) MarshalJSON

func (v *SubmitResponse) MarshalJSON() ([]byte, error)

func (*SubmitResponse) Type

func (*SubmitResponse) Type() Type

func (*SubmitResponse) UnmarshalBinary

func (v *SubmitResponse) UnmarshalBinary(data []byte) error

func (*SubmitResponse) UnmarshalBinaryFrom

func (v *SubmitResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*SubmitResponse) UnmarshalFieldsFrom

func (v *SubmitResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*SubmitResponse) UnmarshalJSON

func (v *SubmitResponse) UnmarshalJSON(data []byte) error

type Submitter

type Submitter struct {
	api.Submitter
}

Submitter forwards [SubmitRequest]s to a api.Submitter.

type SubscribeRequest

type SubscribeRequest struct {
	api.SubscribeOptions
	// contains filtered or unexported fields
}

func (*SubscribeRequest) Copy

func (*SubscribeRequest) CopyAsInterface

func (v *SubscribeRequest) CopyAsInterface() interface{}

func (*SubscribeRequest) Equal

func (v *SubscribeRequest) Equal(u *SubscribeRequest) bool

func (*SubscribeRequest) IsValid

func (v *SubscribeRequest) IsValid() error

func (*SubscribeRequest) MarshalBinary

func (v *SubscribeRequest) MarshalBinary() ([]byte, error)

func (*SubscribeRequest) MarshalJSON

func (v *SubscribeRequest) MarshalJSON() ([]byte, error)

func (*SubscribeRequest) Type

func (*SubscribeRequest) Type() Type

func (*SubscribeRequest) UnmarshalBinary

func (v *SubscribeRequest) UnmarshalBinary(data []byte) error

func (*SubscribeRequest) UnmarshalBinaryFrom

func (v *SubscribeRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*SubscribeRequest) UnmarshalFieldsFrom

func (v *SubscribeRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*SubscribeRequest) UnmarshalJSON

func (v *SubscribeRequest) UnmarshalJSON(data []byte) error

type SubscribeResponse

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

func (*SubscribeResponse) Copy

func (*SubscribeResponse) CopyAsInterface

func (v *SubscribeResponse) CopyAsInterface() interface{}

func (*SubscribeResponse) Equal

func (*SubscribeResponse) IsValid

func (v *SubscribeResponse) IsValid() error

func (*SubscribeResponse) MarshalBinary

func (v *SubscribeResponse) MarshalBinary() ([]byte, error)

func (*SubscribeResponse) MarshalJSON

func (v *SubscribeResponse) MarshalJSON() ([]byte, error)

func (*SubscribeResponse) Type

func (*SubscribeResponse) Type() Type

func (*SubscribeResponse) UnmarshalBinary

func (v *SubscribeResponse) UnmarshalBinary(data []byte) error

func (*SubscribeResponse) UnmarshalBinaryFrom

func (v *SubscribeResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*SubscribeResponse) UnmarshalFieldsFrom

func (v *SubscribeResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*SubscribeResponse) UnmarshalJSON

func (v *SubscribeResponse) UnmarshalJSON(data []byte) error

type Transport

type Transport interface {
	// RoundTrip opens one or more streams to nodes that can serve the requests
	// and processes a request-response round trip on a stream for each request.
	RoundTrip(ctx context.Context, requests []Message, callback ResponseCallback) error

	// OpenStream opens a stream to a node that can serve the request, processes
	// a request-response round trip on the stream, and returns the open stream.
	//
	// If a batch has been opened for the context, multiple calls to OpenStream
	// (with that context) will return the same Stream. Depending on the service
	// it may not be safe to reuse streams in this way.
	//
	// If a batch has _not_ been opened for the context, it is the
	// responsibility of the caller to close the stream or cancel the context.
	OpenStream(ctx context.Context, request Message, callback ResponseCallback) (Stream, error)
}

Transport is a binary message transport implementation.

type Type

type Type int

Type is the type of a Message.

const TypeAddressed Type = 255

TypeAddressed .

const TypeConsensusStatusRequest Type = 3

TypeConsensusStatusRequest .

const TypeConsensusStatusResponse Type = 35

TypeConsensusStatusResponse .

const TypeErrorResponse Type = 32

TypeErrorResponse .

const TypeEvent Type = 64

TypeEvent .

const TypeFaucetRequest Type = 10

TypeFaucetRequest .

const TypeFaucetResponse Type = 42

TypeFaucetResponse .

const TypeFindServiceRequest Type = 2

TypeFindServiceRequest .

const TypeFindServiceResponse Type = 34

TypeFindServiceResponse .

const TypeMetricsRequest Type = 5

TypeMetricsRequest .

const TypeMetricsResponse Type = 37

TypeMetricsResponse .

const TypeNetworkStatusRequest Type = 4

TypeNetworkStatusRequest .

const TypeNetworkStatusResponse Type = 36

TypeNetworkStatusResponse .

const TypeNodeInfoRequest Type = 1

TypeNodeInfoRequest .

const TypeNodeInfoResponse Type = 33

TypeNodeInfoResponse .

const TypePrivateSequenceRequest Type = 128

TypePrivateSequenceRequest .

const TypePrivateSequenceResponse Type = 129

TypePrivateSequenceResponse .

const TypeQueryRequest Type = 6

TypeQueryRequest .

const TypeRecordResponse Type = 38

TypeRecordResponse .

const TypeSubmitRequest Type = 7

TypeSubmitRequest .

const TypeSubmitResponse Type = 39

TypeSubmitResponse .

const TypeSubscribeRequest Type = 9

TypeSubscribeRequest .

const TypeSubscribeResponse Type = 41

TypeSubscribeResponse .

const TypeValidateRequest Type = 8

TypeValidateRequest .

const TypeValidateResponse Type = 40

TypeValidateResponse .

func TypeByName

func TypeByName(name string) (Type, bool)

TypeByName returns the named Type.

func (Type) GetEnumValue

func (v Type) GetEnumValue() uint64

GetEnumValue returns the value of the Type

func (Type) MarshalJSON

func (v Type) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Type to JSON as a string.

func (*Type) SetEnumValue

func (v *Type) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (Type) String

func (v Type) String() string

String returns the name of the Type.

func (*Type) UnmarshalJSON

func (v *Type) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Type from JSON as a string.

type ValidateRequest

type ValidateRequest struct {
	Envelope *messaging.Envelope `json:"envelope,omitempty" form:"envelope" query:"envelope" validate:"required"`
	api.ValidateOptions
	// contains filtered or unexported fields
}

func (*ValidateRequest) Copy

func (v *ValidateRequest) Copy() *ValidateRequest

func (*ValidateRequest) CopyAsInterface

func (v *ValidateRequest) CopyAsInterface() interface{}

func (*ValidateRequest) Equal

func (v *ValidateRequest) Equal(u *ValidateRequest) bool

func (*ValidateRequest) IsValid

func (v *ValidateRequest) IsValid() error

func (*ValidateRequest) MarshalBinary

func (v *ValidateRequest) MarshalBinary() ([]byte, error)

func (*ValidateRequest) MarshalJSON

func (v *ValidateRequest) MarshalJSON() ([]byte, error)

func (*ValidateRequest) Type

func (*ValidateRequest) Type() Type

func (*ValidateRequest) UnmarshalBinary

func (v *ValidateRequest) UnmarshalBinary(data []byte) error

func (*ValidateRequest) UnmarshalBinaryFrom

func (v *ValidateRequest) UnmarshalBinaryFrom(rd io.Reader) error

func (*ValidateRequest) UnmarshalFieldsFrom

func (v *ValidateRequest) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*ValidateRequest) UnmarshalJSON

func (v *ValidateRequest) UnmarshalJSON(data []byte) error

type ValidateResponse

type ValidateResponse struct {
	Value []*api.Submission `json:"value" form:"value" query:"value" validate:"required"`
	// contains filtered or unexported fields
}

func (*ValidateResponse) Copy

func (*ValidateResponse) CopyAsInterface

func (v *ValidateResponse) CopyAsInterface() interface{}

func (*ValidateResponse) Equal

func (v *ValidateResponse) Equal(u *ValidateResponse) bool

func (*ValidateResponse) IsValid

func (v *ValidateResponse) IsValid() error

func (*ValidateResponse) MarshalBinary

func (v *ValidateResponse) MarshalBinary() ([]byte, error)

func (*ValidateResponse) MarshalJSON

func (v *ValidateResponse) MarshalJSON() ([]byte, error)

func (*ValidateResponse) Type

func (*ValidateResponse) Type() Type

func (*ValidateResponse) UnmarshalBinary

func (v *ValidateResponse) UnmarshalBinary(data []byte) error

func (*ValidateResponse) UnmarshalBinaryFrom

func (v *ValidateResponse) UnmarshalBinaryFrom(rd io.Reader) error

func (*ValidateResponse) UnmarshalFieldsFrom

func (v *ValidateResponse) UnmarshalFieldsFrom(reader *encoding.Reader) error

func (*ValidateResponse) UnmarshalJSON

func (v *ValidateResponse) UnmarshalJSON(data []byte) error

type Validator

type Validator struct {
	api.Validator
}

Validator forwards [ValidateRequest]s to a api.Validator.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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