Documentation ¶
Index ¶
- Constants
- Variables
- type Metrics
- type Option
- func DefaultOptions(host host.Host) []Option
- func WithAutomaticPeerSelection(fromThesePeers ...peer.ID) Option
- func WithAutomaticRequestID() Option
- func WithDefaultPubsubTopic() Option
- func WithFastestPeerSelection(fromThesePeers ...peer.ID) Option
- func WithPeer(p peer.ID) Option
- func WithPubSubTopic(pubsubTopic string) Option
- func WithRequestID(requestID []byte) Option
- type WakuLightPush
Constants ¶
const LightPushENRField = uint8(1 << 3)
const LightPushID_v20beta1 = libp2pProtocol.ID("/vac/waku/lightpush/2.0.0-beta1")
LightPushID_v20beta1 is the current Waku LightPush protocol identifier
Variables ¶
var ( ErrNoPeersAvailable = errors.New("no suitable remote peers") ErrInvalidID = errors.New("invalid request id") )
Functions ¶
This section is empty.
Types ¶
type Metrics ¶ added in v0.8.0
type Metrics interface { RecordMessage() RecordError(err metricsErrCategory) }
Metrics exposes the functions required to update prometheus metrics for lightpush protocol
type Option ¶ added in v0.8.0
type Option func(*lightPushParameters)
Option is the type of options accepted when performing LightPush protocol requests
func DefaultOptions ¶
DefaultOptions are the default options to be used when using the lightpush protocol
func WithAutomaticPeerSelection ¶
WithAutomaticPeerSelection is an option used to randomly select a peer from the peer store to push a waku message to. If a list of specific peers is passed, the peer will be chosen from that list assuming it supports the chosen protocol, otherwise it will chose a peer from the node peerstore
func WithAutomaticRequestID ¶ added in v0.8.0
func WithAutomaticRequestID() Option
WithAutomaticRequestID is an option to automatically generate a request ID when publishing a message
func WithDefaultPubsubTopic ¶ added in v0.9.0
func WithDefaultPubsubTopic() Option
WithDefaultPubsubTopic is used to indicate that the message should be broadcasted in the default pubsub topic
func WithFastestPeerSelection ¶
WithFastestPeerSelection is an option used to select a peer from the peer store with the lowest ping. If a list of specific peers is passed, the peer will be chosen from that list assuming it supports the chosen protocol, otherwise it will chose a peer from the node peerstore
func WithPubSubTopic ¶ added in v0.8.1
WithPubSubTopic is used to specify the pubsub topic on which a WakuMessage will be broadcasted
func WithRequestID ¶ added in v0.8.0
WithRequestID is an option to set a specific request ID to be used when publishing a message
type WakuLightPush ¶
type WakuLightPush struct {
// contains filtered or unexported fields
}
WakuLightPush is the implementation of the Waku LightPush protocol
func NewWakuLightPush ¶
func NewWakuLightPush(relay *relay.WakuRelay, pm *peermanager.PeerManager, reg prometheus.Registerer, log *zap.Logger) *WakuLightPush
NewWakuLightPush returns a new instance of Waku Lightpush struct Takes an optional peermanager if WakuLightPush is being created along with WakuNode. If using libp2p host, then pass peermanager as nil
func (*WakuLightPush) Publish ¶
func (wakuLP *WakuLightPush) Publish(ctx context.Context, message *wpb.WakuMessage, opts ...Option) ([]byte, error)
Publish is used to broadcast a WakuMessage to the pubSubTopic (which is derived from the contentTopic) via lightpush protocol. If auto-sharding is not to be used, then the `WithPubSubTopic` option should be provided to publish the message to an specific pubSubTopic
func (*WakuLightPush) SetHost ¶ added in v0.6.0
func (wakuLP *WakuLightPush) SetHost(h host.Host)
Sets the host to be able to mount or consume a protocol
func (*WakuLightPush) Start ¶
func (wakuLP *WakuLightPush) Start(ctx context.Context) error
Start inits the lighpush protocol
func (*WakuLightPush) Stop ¶
func (wakuLP *WakuLightPush) Stop()
Stop unmounts the lightpush protocol