Documentation ¶
Index ¶
- Constants
- Variables
- func NewFloodSub(ctx context.Context, le *logrus.Entry, handler pubsub.PubSubHandler, ...) (pubsub.PubSub, error)
- type Config
- func (*Config) Descriptor() ([]byte, []int)
- func (m *Config) GetPublishHashType() hash.HashType
- func (*Config) ProtoMessage()
- func (m *Config) Reset()
- func (m *Config) String() string
- func (c *Config) Validate() error
- func (m *Config) XXX_DiscardUnknown()
- func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Config) XXX_Merge(src proto.Message)
- func (m *Config) XXX_Size() int
- func (m *Config) XXX_Unmarshal(b []byte) error
- type FloodSub
- func (m *FloodSub) AddPeerStream(tpl pubsub.PeerLinkTuple, initiator bool, mstrm link.MountedStream)
- func (m *FloodSub) AddSubscription(ctx context.Context, privKey crypto.PrivKey, channelID string) (pubsub.Subscription, error)
- func (m *FloodSub) Close()
- func (m *FloodSub) Execute(ctx context.Context) error
- func (m *FloodSub) Publish(ctx context.Context, channelID string, privKey crypto.PrivKey, data []byte) error
- type Packet
- func (*Packet) Descriptor() ([]byte, []int)
- func (m *Packet) GetPublish() []*peer.SignedMsg
- func (m *Packet) GetSubscriptions() []*SubscriptionOpts
- func (*Packet) ProtoMessage()
- func (m *Packet) Reset()
- func (m *Packet) String() string
- func (m *Packet) XXX_DiscardUnknown()
- func (m *Packet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Packet) XXX_Merge(src proto.Message)
- func (m *Packet) XXX_Size() int
- func (m *Packet) XXX_Unmarshal(b []byte) error
- type SubscriptionOpts
- func (*SubscriptionOpts) Descriptor() ([]byte, []int)
- func (m *SubscriptionOpts) GetChannelId() string
- func (m *SubscriptionOpts) GetSubscribe() bool
- func (*SubscriptionOpts) ProtoMessage()
- func (m *SubscriptionOpts) Reset()
- func (m *SubscriptionOpts) String() string
- func (m *SubscriptionOpts) XXX_DiscardUnknown()
- func (m *SubscriptionOpts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SubscriptionOpts) XXX_Merge(src proto.Message)
- func (m *SubscriptionOpts) XXX_Size() int
- func (m *SubscriptionOpts) XXX_Unmarshal(b []byte) error
Constants ¶
View Source
const (
FloodSubID = protocol.ID("bifrost/floodsub/1")
)
Variables ¶
View Source
var ( HeartbeatInitialDelay = 100 * time.Millisecond HeartbeatInterval = 1 * time.Second SubFanoutTTL = 60 * time.Second )
Functions ¶
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 */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Config configures the floodsub router.
func (*Config) Descriptor ¶
func (*Config) GetPublishHashType ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) XXX_DiscardUnknown ¶
func (m *Config) XXX_DiscardUnknown()
func (*Config) XXX_Marshal ¶
func (*Config) XXX_Unmarshal ¶
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.
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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Packet is the floodsub packet.
func (*Packet) Descriptor ¶
func (*Packet) GetPublish ¶
func (*Packet) GetSubscriptions ¶
func (m *Packet) GetSubscriptions() []*SubscriptionOpts
func (*Packet) ProtoMessage ¶
func (*Packet) ProtoMessage()
func (*Packet) XXX_DiscardUnknown ¶
func (m *Packet) XXX_DiscardUnknown()
func (*Packet) XXX_Marshal ¶
func (*Packet) XXX_Unmarshal ¶
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"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
SubscriptionOpts are subscription options.
func (*SubscriptionOpts) Descriptor ¶
func (*SubscriptionOpts) Descriptor() ([]byte, []int)
func (*SubscriptionOpts) GetChannelId ¶
func (m *SubscriptionOpts) GetChannelId() string
func (*SubscriptionOpts) GetSubscribe ¶
func (m *SubscriptionOpts) GetSubscribe() bool
func (*SubscriptionOpts) ProtoMessage ¶
func (*SubscriptionOpts) ProtoMessage()
func (*SubscriptionOpts) Reset ¶
func (m *SubscriptionOpts) Reset()
func (*SubscriptionOpts) String ¶
func (m *SubscriptionOpts) String() string
func (*SubscriptionOpts) XXX_DiscardUnknown ¶
func (m *SubscriptionOpts) XXX_DiscardUnknown()
func (*SubscriptionOpts) XXX_Marshal ¶
func (m *SubscriptionOpts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SubscriptionOpts) XXX_Merge ¶
func (m *SubscriptionOpts) XXX_Merge(src proto.Message)
func (*SubscriptionOpts) XXX_Size ¶
func (m *SubscriptionOpts) XXX_Size() int
func (*SubscriptionOpts) XXX_Unmarshal ¶
func (m *SubscriptionOpts) XXX_Unmarshal(b []byte) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.