package pubsub
Import Path
/pkg/pubsub (on go.dev )
Dependency Relation
imports 29 packages , and imported by 0 packages
Package-Level Type Names (total 21)
/* sort by: alphabet | popularity */
type Topic (struct)
Topic is a single-topic PubSub based on lib2p-pubsub with manual discovery.
Each peer can have many exposed state machines and broadcasts their clock
changes on the channel, introduces them when joining and via private messages
to newly joined peers.
TODO optimizations:
- avoid txs which will get cancelled (CPU)
- rate limit the TOTAL amount of msgs in the network (CPU, network)
- hook into libp2p errors, eg queue full, and act accordingly
Fields (total 22 )
Addrs atomic .Pointer [[]ma .Multiaddr ]
Addrs is a list of addresses for this peer.
ConnAddrs []ma .Multiaddr
ConnAddrs contains a list of addresses for initial
connections to discovery nodes in the network.
ConnectionsToReady int
DbgNetMachs bool
DbgNetMachs exposes local network machines via to am-dbg
Debounce time .Time
Debounce for clock broadcasts (separate per each exposed state machine).
ExceptionHandler *am .ExceptionHandler
ExposedMachs []*am .Machine
List of exposed state machines, index => mach_id, indexes are used on the
channel. Indexes should NOT change, as they are used for addressing. `nil`
value means empty.
GossipAmount int
Number of gossips to send in SendGossipsState
HeartbeatFreq time .Duration
HeartbeatFreq broadcasts changed clocks of exposed machines.
HostToPeer map[string ]string
ListenAddrs []ma .Multiaddr
ListenAddrs contains the list of multiaddresses that this topic listens on.
None will allocate one automatically.
LogEnabled bool
Mach *am .Machine
Mach is a state machine for this PubSub.
MachMetrics atomic .Pointer [am .Machine ]
MaxMsgsPerWin int
Maximum msgs per minute sent to the network. Does not include MsgInfo,
which are debounced.
MaxQueueLen uint16
Max allowed queue length to send MsgInfo to newly joned peers, as well as
received msgs.
Multiplayer int
all amounts and delayes are multiplied by this factor
Name string
Name indicates the name of the channel or topic instance,
typically associated with a given process.
SendInfoDebounceMs int
T *ps .Topic
T represents the PubSub topic used for communication.
TestSchema am .Schema
Use this hardcoded schema instead of exchanging real ones. Limits all the
workers to this one.
TODO catalog of named schemas, exchange unknown ones
TestStates am .S
Methods (total 57 )
(*Topic) ConnCount () int
(*Topic) ConnectingEnter (e *am .Event ) bool
(*Topic) ConnectingState (e *am .Event )
(*Topic) Dispose () am .Result
(*Topic) DoSendInfoEnter (e *am .Event ) bool
(*Topic) DoSendInfoState (e *am .Event )
(*Topic) ExceptionEnter (e *am .Event ) bool
(*Topic) ExceptionState (e *am .Event )
(*Topic) GetPeerAddrs () ([]ma .Multiaddr , error )
(*Topic) HeartbeatState (e *am .Event )
(*Topic) Join () am .Result
(*Topic) JoinedEnd (e *am .Event )
(*Topic) JoinedState (e *am .Event )
(*Topic) JoiningState (e *am .Event )
(*Topic) ListMachinesEnter (e *am .Event ) bool
(*Topic) ListMachinesState (e *am .Event )
(*Topic) MissPeersByGossipEnter (e *am .Event ) bool
(*Topic) MissPeersByGossipExit (e *am .Event ) bool
(*Topic) MissPeersByGossipState (e *am .Event )
(*Topic) MissPeersByUpdatesEnter (e *am .Event ) bool
(*Topic) MissPeersByUpdatesExit (e *am .Event ) bool
(*Topic) MissPeersByUpdatesState (e *am .Event )
(*Topic) MissUpdatesByGossipEnter (e *am .Event ) bool
(*Topic) MissUpdatesByGossipExit (e *am .Event ) bool
(*Topic) MissUpdatesByGossipState (e *am .Event )
(*Topic) MsgByeEnter (e *am .Event ) bool
(*Topic) MsgInfoEnter (e *am .Event ) bool
(*Topic) MsgInfoState (e *am .Event )
(*Topic) MsgReceivedEnter (e *am .Event ) bool
(*Topic) MsgReqInfoEnter (e *am .Event ) bool
(*Topic) MsgReqInfoState (e *am .Event )
(*Topic) MsgReqUpdatesEnter (e *am .Event ) bool
(*Topic) MsgReqUpdatesState (e *am .Event )
TODO this is never fired
(*Topic) MsgUpdatesEnter (e *am .Event ) bool
(*Topic) MsgUpdatesState (e *am .Event )
(*Topic) PeerJoinedEnter (e *am .Event ) bool
(*Topic) PeerJoinedState (e *am .Event )
(*Topic) PeerLeftEnter (e *am .Event ) bool
(*Topic) ProcessMsgsState (e *am .Event )
(*Topic) ReadyEnter (e *am .Event ) bool
TODO exit
(*Topic) ReqMissingPeersEnter (e *am .Event ) bool
(*Topic) ReqMissingPeersState (e *am .Event )
(*Topic) ReqMissingUpdatesEnter (e *am .Event ) bool
(*Topic) ReqMissingUpdatesState (e *am .Event )
(*Topic) SendGossipsEnter (e *am .Event ) bool
(*Topic) SendGossipsState (e *am .Event )
(*Topic) SendInfoEnter (e *am .Event ) bool
(*Topic) SendInfoState (e *am .Event )
(*Topic) SendMsgEnter (e *am .Event ) bool
(*Topic) SendMsgState (e *am .Event )
(*Topic) SendUpdatesEnter (e *am .Event ) bool
(*Topic) SendUpdatesState (e *am .Event )
(*Topic) Start () am .Result
(*Topic) StartAndJoin (ctx context .Context ) am .Result
(*Topic) StartEnd (e *am .Event )
(*Topic) StartEnter (e *am .Event ) bool
(*Topic) StartState (e *am .Event )
As Outputs Of (at least one exported )
func NewTopic (ctx context .Context , name, suffix string , exposedMachs []*am .Machine , opts *TopicOpts ) (*Topic , error )
Package-Level Functions (total 6)
Package-Level Variables (total 2)
Package-Level Constants (total 9)
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .