floodsub

package module
v0.0.0-...-e6d96a7 Latest Latest
Warning

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

Go to latest
Published: May 30, 2017 License: MIT Imports: 16 Imported by: 0

README

go-floodsub

A flooding pubsub system.

Table of Contents

Install

go get github.com/libp2p/go-floodsub

Usage

TODO

Contribute

Contributions welcome. Please check out the issues.

Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS Code of Conduct.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © Jeromy Johnson

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	*pb.Message
}

func (*Message) GetFrom

func (m *Message) GetFrom() peer.ID

type PubSub

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

func NewFloodSub

func NewFloodSub(ctx context.Context, h host.Host) *PubSub

NewFloodSub returns a new FloodSub management object

func (*PubSub) GetTopics

func (p *PubSub) GetTopics() []string

GetTopics returns the topics this node is subscribed to

func (*PubSub) ListPeers

func (p *PubSub) ListPeers(topic string) []peer.ID

ListPeers returns a list of peers we are connected to.

func (*PubSub) Publish

func (p *PubSub) Publish(topic string, data []byte) error

Publish publishes data under the given topic

func (*PubSub) Subscribe

func (p *PubSub) Subscribe(topic string) (*Subscription, error)

Subscribe returns a new Subscription for the given topic

func (*PubSub) SubscribeByTopicDescriptor

func (p *PubSub) SubscribeByTopicDescriptor(td *pb.TopicDescriptor) (*Subscription, error)

SubscribeByTopicDescriptor lets you subscribe a topic using a pb.TopicDescriptor

type PubSubNotif

type PubSubNotif PubSub

func (*PubSubNotif) ClosedStream

func (p *PubSubNotif) ClosedStream(n inet.Network, s inet.Stream)

func (*PubSubNotif) Connected

func (p *PubSubNotif) Connected(n inet.Network, c inet.Conn)

func (*PubSubNotif) Disconnected

func (p *PubSubNotif) Disconnected(n inet.Network, c inet.Conn)

func (*PubSubNotif) Listen

func (p *PubSubNotif) Listen(n inet.Network, _ ma.Multiaddr)

func (*PubSubNotif) ListenClose

func (p *PubSubNotif) ListenClose(n inet.Network, _ ma.Multiaddr)

func (*PubSubNotif) OpenedStream

func (p *PubSubNotif) OpenedStream(n inet.Network, s inet.Stream)

type RPC

type RPC struct {
	pb.RPC
	// contains filtered or unexported fields
}

type Subscription

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

func (*Subscription) Cancel

func (sub *Subscription) Cancel()

func (*Subscription) Next

func (sub *Subscription) Next(ctx context.Context) (*Message, error)

func (*Subscription) Topic

func (sub *Subscription) Topic() string

Directories

Path Synopsis
Package floodsub_pb is a generated protocol buffer package.
Package floodsub_pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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