go-libp2p-pubsub-router: github.com/libp2p/go-libp2p-pubsub-router Index | Files | Directories

package namesys

import "github.com/libp2p/go-libp2p-pubsub-router"


Package Files

fetch.go pubsub.go


const FetchProtoID = protocol.ID("/libp2p/fetch/0.0.1")

func KeyToTopic Uses

func KeyToTopic(key string) string

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

type Option Uses

type Option func(*PubsubValueStore) error

Option is a function that configures a PubsubValueStore during initialization

func WithRebroadcastInitialDelay Uses

func WithRebroadcastInitialDelay(duration time.Duration) Option

func WithRebroadcastInterval Uses

func WithRebroadcastInterval(duration time.Duration) Option

type Pubsub Uses

type Pubsub interface {
    RegisterTopicValidator(topic string, validator interface{}, opts ...pubsub.ValidatorOpt) error
    Join(topic string, opts ...pubsub.TopicOpt) (*pubsub.Topic, error)

Pubsub is the minimal subset of the pubsub interface required by the pubsub value store. This way, users can wrap the underlying pubsub implementation without re-exporting/implementing the entire interface.

type PubsubValueStore Uses

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

func NewPubsubValueStore Uses

func NewPubsubValueStore(ctx context.Context, host host.Host, ps Pubsub, validator record.Validator, opts ...Option) (*PubsubValueStore, error)

NewPubsubValueStore constructs a new ValueStore that gets and receives records through pubsub.

func (*PubsubValueStore) Cancel Uses

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

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

func (*PubsubValueStore) GetSubscriptions Uses

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

GetSubscriptions retrieves a list of active topic subscriptions

func (*PubsubValueStore) GetValue Uses

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

func (*PubsubValueStore) PutValue Uses

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

PutValue publishes a record through pubsub

func (*PubsubValueStore) SearchValue Uses

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

func (*PubsubValueStore) Subscribe Uses

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



Package namesys imports 22 packages (graph) and is imported by 19 packages. Updated 2020-08-22. Refresh now. Tools for package owners.