channel

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotOwner       = errors.New("Not owner of key - (Beam)")
	ErrNotFound       = errors.New("Key not found in store - (Beam)")
	ErrInvalidMessage = errors.New("Invalid message received in Pubsub Topic - (Beam)")
)

Functions

This section is empty.

Types

type Channel

type Channel interface {
	// Did returns the DID of the channel.
	Did() string

	// Read returns a list of all peers subscribed to the channel topic.
	Read() []peer.ID

	// Publish publishes the given message to the channel topic.
	Publish(obj *ot.ObjectDoc) error

	// Listen subscribes to the beam topic and returns a channel that will
	// receive events.
	Listen(opChan chan *ct.ChannelMessage)

	// Close closes the channel.
	Close() error
}

Channel is a pubsub based Key-Value store for Libp2p nodes.

func New

func New(ctx context.Context, n nh.HostImpl, config *ct.ChannelDoc, options ...Option) (Channel, error)

New creates a new beam with the given name and options.

type Option

type Option func(*options)

Option is a function that modifies the beam options.

func WithCapacity

func WithCapacity(capacity int) Option

WithCapacity sets the capacity of the beam store.

func WithTTL

func WithTTL(ttl time.Duration) Option

WithTTL sets the time-to-live for the beam store entries

Jump to

Keyboard shortcuts

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