Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App interface { // LocalEventListen returns a listener that is notified of *locally generated* // events. Caller should call .Discard() when done. LocalEventListen() *LocalEventListener // HandleNetRecord handles an inbound thread record from net. HandleNetRecord(rec net.ThreadRecord, key thread.Key, lid peer.ID, timeout time.Duration) error }
App provides a bidirectional hook for thread-based apps.
type Connection ¶
Connection receives new thread records, which are pumped to the app.
type Connector ¶
type Connector struct { Net Net // contains filtered or unexported fields }
Connector connects an app to a thread.
func NewConnector ¶
NewConnector creates bidirectional connection between an app and a thread.
type LocalEvent ¶
LocalEvent wraps an IPLD node and auth for delivery to a thread.
type LocalEventListener ¶
type LocalEventListener struct {
// contains filtered or unexported fields
}
LocalEventListener notifies about new locally generated events.
func (*LocalEventListener) Channel ¶
func (l *LocalEventListener) Channel() <-chan *LocalEvent
Channel returns an unbuffered channel to receive local events.
func (*LocalEventListener) Discard ¶
func (l *LocalEventListener) Discard()
Discard indicates that no further events will be received and ready for being garbage collected.
type LocalEventsBus ¶
type LocalEventsBus struct {
// contains filtered or unexported fields
}
LocalEventsBus wraps a broadcaster for local events.
func NewLocalEventsBus ¶
func NewLocalEventsBus() *LocalEventsBus
NewLocalEventsBus returns a new bus for local event.
func (*LocalEventsBus) Discard ¶
func (leb *LocalEventsBus) Discard()
Discard the bus, closing all listeners.
func (*LocalEventsBus) Listen ¶
func (leb *LocalEventsBus) Listen() *LocalEventListener
Listen returns a local event listener.
func (*LocalEventsBus) Send ¶
func (leb *LocalEventsBus) Send(event *LocalEvent) error
Send an IPLD node and thread auth into the bus. These are received by the app connector and written to the underlying thread.