floodsub

package
v0.20.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FloodSubID = protocol.ID("bifrost/floodsub")
)

Variables

View Source
var (
	HeartbeatInitialDelay = 100 * time.Millisecond
	HeartbeatInterval     = 1 * time.Second
	SubFanoutTTL          = 60 * time.Second
)
View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
var File_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto protoreflect.FileDescriptor

Functions

func NewFloodSub

func NewFloodSub(
	ctx context.Context,
	le *logrus.Entry,
	handler pubsub.PubSubHandler,
	cc *Config,
) (pubsub.PubSub, error)

NewFloodSub constructs a new FloodSub PubSub router.

Types

type Config

type Config struct {

	// PublishHashType is the hash type to use when signing published messages.
	// Defaults to sha256
	PublishHashType hash.HashType `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

Config configures the floodsub router.

func (*Config) CloneMessageVT added in v0.15.6

func (m *Config) CloneMessageVT() proto.Message

func (*Config) CloneVT added in v0.8.3

func (m *Config) CloneVT() *Config

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) EqualMessageVT added in v0.15.6

func (this *Config) EqualMessageVT(thatMsg proto.Message) bool

func (*Config) EqualVT added in v0.3.0

func (this *Config) EqualVT(that *Config) bool

func (*Config) GetPublishHashType

func (x *Config) GetPublishHashType() hash.HashType

func (*Config) MarshalToSizedBufferVT added in v0.2.0

func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Config) MarshalToVT added in v0.2.0

func (m *Config) MarshalToVT(dAtA []byte) (int, error)

func (*Config) MarshalVT added in v0.2.0

func (m *Config) MarshalVT() (dAtA []byte, err error)

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect added in v0.2.0

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) SizeVT added in v0.2.0

func (m *Config) SizeVT() (n int)

func (*Config) String

func (x *Config) String() string

func (*Config) UnmarshalVT added in v0.2.0

func (m *Config) UnmarshalVT(dAtA []byte) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

type FloodSub

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

FloodSub implements the FloodSub router.

TODO bind to a specific peer

func (*FloodSub) AddPeerStream

func (m *FloodSub) AddPeerStream(
	tpl pubsub.PeerLinkTuple,
	initiator bool,
	mstrm link.MountedStream,
)

AddPeerStream adds a negotiated peer stream. The pubsub should communicate over the stream.

func (*FloodSub) AddSubscription

func (m *FloodSub) AddSubscription(ctx context.Context, privKey crypto.PrivKey, channelID string) (pubsub.Subscription, error)

AddSubscription adds a channel subscription, returning a subscription handle.

func (*FloodSub) Close

func (m *FloodSub) Close()

Close closes the pubsub.

func (*FloodSub) Execute

func (m *FloodSub) Execute(ctx context.Context) error

Execute executes the PubSub routines.

func (*FloodSub) Publish

func (m *FloodSub) Publish(
	ctx context.Context,
	channelID string,
	privKey crypto.PrivKey,
	data []byte,
) error

Publish writes to the channel with a private key.

type Packet

type Packet struct {

	// Subscriptions contains any new subscription changes.
	Subscriptions []*SubscriptionOpts `protobuf:"bytes,1,rep,name=subscriptions,proto3" json:"subscriptions,omitempty"`
	// Publish contains messages we are publishing.
	Publish []*peer.SignedMsg `protobuf:"bytes,2,rep,name=publish,proto3" json:"publish,omitempty"`
	// contains filtered or unexported fields
}

Packet is the floodsub packet.

func (*Packet) CloneMessageVT added in v0.15.6

func (m *Packet) CloneMessageVT() proto.Message

func (*Packet) CloneVT added in v0.8.3

func (m *Packet) CloneVT() *Packet

func (*Packet) Descriptor deprecated

func (*Packet) Descriptor() ([]byte, []int)

Deprecated: Use Packet.ProtoReflect.Descriptor instead.

func (*Packet) EqualMessageVT added in v0.15.6

func (this *Packet) EqualMessageVT(thatMsg proto.Message) bool

func (*Packet) EqualVT added in v0.3.0

func (this *Packet) EqualVT(that *Packet) bool

func (*Packet) GetPublish

func (x *Packet) GetPublish() []*peer.SignedMsg

func (*Packet) GetSubscriptions

func (x *Packet) GetSubscriptions() []*SubscriptionOpts

func (*Packet) MarshalToSizedBufferVT added in v0.2.0

func (m *Packet) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Packet) MarshalToVT added in v0.2.0

func (m *Packet) MarshalToVT(dAtA []byte) (int, error)

func (*Packet) MarshalVT added in v0.2.0

func (m *Packet) MarshalVT() (dAtA []byte, err error)

func (*Packet) ProtoMessage

func (*Packet) ProtoMessage()

func (*Packet) ProtoReflect added in v0.2.0

func (x *Packet) ProtoReflect() protoreflect.Message

func (*Packet) Reset

func (x *Packet) Reset()

func (*Packet) SizeVT added in v0.2.0

func (m *Packet) SizeVT() (n int)

func (*Packet) String

func (x *Packet) String() string

func (*Packet) UnmarshalVT added in v0.2.0

func (m *Packet) UnmarshalVT(dAtA []byte) error

type SubscriptionOpts

type SubscriptionOpts struct {

	// Subscribe indicates if we are subscribing to this channel ID.
	Subscribe bool `protobuf:"varint,1,opt,name=subscribe,proto3" json:"subscribe,omitempty"`
	// ChannelId is the channel to subscribe to.
	ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`
	// contains filtered or unexported fields
}

SubscriptionOpts are subscription options.

func (*SubscriptionOpts) CloneMessageVT added in v0.15.6

func (m *SubscriptionOpts) CloneMessageVT() proto.Message

func (*SubscriptionOpts) CloneVT added in v0.8.3

func (m *SubscriptionOpts) CloneVT() *SubscriptionOpts

func (*SubscriptionOpts) Descriptor deprecated

func (*SubscriptionOpts) Descriptor() ([]byte, []int)

Deprecated: Use SubscriptionOpts.ProtoReflect.Descriptor instead.

func (*SubscriptionOpts) EqualMessageVT added in v0.15.6

func (this *SubscriptionOpts) EqualMessageVT(thatMsg proto.Message) bool

func (*SubscriptionOpts) EqualVT added in v0.3.0

func (this *SubscriptionOpts) EqualVT(that *SubscriptionOpts) bool

func (*SubscriptionOpts) GetChannelId

func (x *SubscriptionOpts) GetChannelId() string

func (*SubscriptionOpts) GetSubscribe

func (x *SubscriptionOpts) GetSubscribe() bool

func (*SubscriptionOpts) MarshalToSizedBufferVT added in v0.2.0

func (m *SubscriptionOpts) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*SubscriptionOpts) MarshalToVT added in v0.2.0

func (m *SubscriptionOpts) MarshalToVT(dAtA []byte) (int, error)

func (*SubscriptionOpts) MarshalVT added in v0.2.0

func (m *SubscriptionOpts) MarshalVT() (dAtA []byte, err error)

func (*SubscriptionOpts) ProtoMessage

func (*SubscriptionOpts) ProtoMessage()

func (*SubscriptionOpts) ProtoReflect added in v0.2.0

func (x *SubscriptionOpts) ProtoReflect() protoreflect.Message

func (*SubscriptionOpts) Reset

func (x *SubscriptionOpts) Reset()

func (*SubscriptionOpts) SizeVT added in v0.2.0

func (m *SubscriptionOpts) SizeVT() (n int)

func (*SubscriptionOpts) String

func (x *SubscriptionOpts) String() string

func (*SubscriptionOpts) UnmarshalVT added in v0.2.0

func (m *SubscriptionOpts) UnmarshalVT(dAtA []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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