dappclient

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppClient

type AppClient interface {
	WriteMessage(ctx context.Context, channel string, msg interface{}) error
	ReadMessage(ctx context.Context, channel string, message interface{}) error
	CommitMessage(ctx context.Context, channel string) error
}

AppClient defines an interface and its methods for a dApp Client

type Client

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

Client is the struct which implements the methods of AppClient interface

func NewAppClient

func NewAppClient() *Client

NewAppClient returns a new instance of the client of the AppClient package

func (*Client) GetRouteMetric added in v0.1.4

func (c *Client) GetRouteMetric(route string) routeMetric

func (*Client) HandleChannel

func (c *Client) HandleChannel(channel string, handler func(ctx context.Context, body io.Reader) error)

HandleChannel handles messages received in a given channel.

func (*Client) HandleRoute added in v0.1.4

func (c *Client) HandleRoute(path string, handler func(w http.ResponseWriter, r *http.Request))

HandleRoute handles messages received in a given route.

func (*Client) Run

func (c *Client) Run(ctx context.Context) error

Run runs the server with the handlers defined in HandleChannel

func (*Client) SendRequest added in v0.1.4

func (c *Client) SendRequest(ctx context.Context, nodeName, path, method string, body interface{}, responsePtr interface{}) error

SendRequest receives the http request informations and send it to the sidecar server

func (*Client) WriteMessage

func (c *Client) WriteMessage(ctx context.Context, channel string, msg interface{}) error

WriteMessage receives a channel and a message and sends it in a request to the sidecar server

Jump to

Keyboard shortcuts

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