client

package
v1.0.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: Apache-2.0, MIT Imports: 14 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithPubsub

func WithPubsub(ps *pubsub.PubSub) client.Option

WithPubsub provides an option for integrating pubsub notification into a drand client.

Types

type Client

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

Client is a concrete pubsub client implementation

func NewWithPubsub

func NewWithPubsub(ps *pubsub.PubSub, info *chain.Info, cache client.Cache) (*Client, error)

NewWithPubsub creates a gossip randomness client.

func (*Client) Close

func (c *Client) Close() error

Close stops Client, cancels PubSub subscription and closes the topic.

func (*Client) SetLog

func (c *Client) SetLog(l log.Logger)

SetLog configures the client log output

func (*Client) Sub

func (c *Client) Sub(ch chan drand.PublicRandResponse) UnsubFunc

Sub subscribes to notfications about new randomness. Client instnace owns the channel after it is passed to Sub function, thus the channel should not be closed by library user

It is recommended to use a buffered channel. If the channel is full, notification about randomness will be dropped.

Notification channels will be closed when the client is Closed

func (*Client) Watch

func (c *Client) Watch(ctx context.Context) <-chan client.Result

Watch implements the client.Watcher interface

type UnsubFunc

type UnsubFunc func()

UnsubFunc is a cancel function for pubsub subscription

Jump to

Keyboard shortcuts

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