namesys

package
v0.0.0-...-8b9b725 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: MIT, MIT Imports: 19 Imported by: 4

README

go-libp2p-pubsub-router

standard-readme compliant GoDoc Coverage Status Build Status

A libp2p router that uses pubsub.

We currently only use this for IPNS over PubSub.

Documenation

See https://godoc.org/github.com/libp2p/go-libp2p-pubsub-router.

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

Want to hack on IPFS?

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyToTopic

func KeyToTopic(key string) string

KeyToTopic converts a binary record key to a pubsub topic key.

Types

type PubsubValueStore

type PubsubValueStore struct {
	Validator record.Validator
	// contains filtered or unexported fields
}

func NewPubsubValueStore

func NewPubsubValueStore(ctx context.Context, host p2phost.Host, cr routing.ContentRouting, ps *pubsub.PubSub, validator record.Validator) *PubsubValueStore

NewPubsubPublisher constructs a new Publisher that publishes IPNS records through pubsub. The constructor interface is complicated by the need to bootstrap the pubsub topic. This could be greatly simplified if the pubsub implementation handled bootstrap itself

func (*PubsubValueStore) Cancel

func (p *PubsubValueStore) Cancel(name string) (bool, error)

Cancel cancels a topic subscription; returns true if an active subscription was canceled

func (*PubsubValueStore) GetSubscriptions

func (p *PubsubValueStore) GetSubscriptions() []string

GetSubscriptions retrieves a list of active topic subscriptions

func (*PubsubValueStore) GetValue

func (p *PubsubValueStore) GetValue(ctx context.Context, key string, opts ...ropts.Option) ([]byte, error)

func (*PubsubValueStore) PutValue

func (p *PubsubValueStore) PutValue(ctx context.Context, key string, value []byte, opts ...ropts.Option) error

Publish publishes an IPNS record through pubsub with default TTL

func (*PubsubValueStore) SearchValue

func (p *PubsubValueStore) SearchValue(ctx context.Context, key string, opts ...ropts.Option) (<-chan []byte, error)

func (*PubsubValueStore) Subscribe

func (p *PubsubValueStore) Subscribe(key string) error

Jump to

Keyboard shortcuts

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