Documentation ¶
Index ¶
- type Client
- func (c *Client) HandleProviderResponse(msg []byte)
- func (c *Client) HandleProviderStream(s network.Stream)
- func (c *Client) Start() error
- func (c *Client) Stop() error
- func (c *Client) SubmitQuery(ctx context.Context, params shared.Params) error
- func (c *Client) SubscribeToQueryResponses(subscriber ClientSubscriber, params shared.Params) Unsubscribe
- type ClientSubscriber
- type Network
- type Unsubscribe
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) HandleProviderResponse ¶
HandleProviderResponse is called to handle a QueryResponse from a provider
func (*Client) HandleProviderStream ¶
HandleProviderStream reads the first message and calls HandleProviderResponse Note: implements the libp2p StreamHandler interface
func (*Client) SubmitQuery ¶
SubmitQuery encodes a query and submits it to the network to be gossiped
func (*Client) SubscribeToQueryResponses ¶
func (c *Client) SubscribeToQueryResponses(subscriber ClientSubscriber, params shared.Params) Unsubscribe
SubscribeQueryResponses registers a subscriber as a listener for a specific payload CID. It returns an unsubscribe method that can be called to terminate the subscription.
type ClientSubscriber ¶
type ClientSubscriber func(resp shared.QueryResponse)
type Network ¶
type Network interface { Start() error Stop() error // Publish broadcasts a message over pub sub on the default topic Publish(ctx context.Context, msg []byte) error // Returns all the hosts multiaddrs MultiAddrs() []string RegisterStreamHandler(id core.ProtocolID, handler network.StreamHandler) }
Network defines the libp2p network interface used by the client
type Unsubscribe ¶
type Unsubscribe func()
Click to show internal directories.
Click to hide internal directories.