Documentation
¶
Index ¶
- Variables
- func DeleteStoreKey(s *v1.ChannelStore, key string, b *channel) error
- func GetKey(s *v1.ChannelStore, key string) ([]byte, error)
- func HandleStore(s *v1.ChannelStore, e *v1.ChannelEvent, b *channel) error
- func NewStore(opts *options) *v1.ChannelStore
- func PublishEvent(ctx context.Context, t *ps.Topic, e *v1.ChannelEvent) error
- func PutStoreKey(s *v1.ChannelStore, key string, value []byte, b *channel) error
- func SetStoreEntry(se *v1.ChannelStoreRecord, value []byte, selfID string) (*v1.ChannelEvent, error)
- type Channel
- type Option
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func DeleteStoreKey ¶ added in v0.14.0
func DeleteStoreKey(s *v1.ChannelStore, key string, b *channel) error
Delete deletes an entry from the store and publishes an event
func GetKey ¶ added in v0.14.0
func GetKey(s *v1.ChannelStore, key string) ([]byte, error)
Get returns the value of the entry
func HandleStore ¶ added in v0.14.0
func HandleStore(s *v1.ChannelStore, e *v1.ChannelEvent, b *channel) error
Handle checks the event type and handles it with the store
func NewStore ¶ added in v0.12.5
func NewStore(opts *options) *v1.ChannelStore
NewStore creates a new store
func PublishEvent ¶ added in v0.14.0
Publish publishes the event to the topic
func PutStoreKey ¶ added in v0.14.0
func PutStoreKey(s *v1.ChannelStore, key string, value []byte, b *channel) error
Put puts an entry into the store and publishes an event
func SetStoreEntry ¶ added in v0.14.0
func SetStoreEntry(se *v1.ChannelStoreRecord, value []byte, selfID string) (*v1.ChannelEvent, error)
Set updates the entry in the store and publishes an event
Types ¶
type Channel ¶
type Channel interface { // Did returns the DID of the channel. Did() string // Get returns the value for the given key. Get(key string) ([]byte, error) // Put stores the value for the given key. Put(key string, value []byte) error // Delete removes the value for the given key. Delete(key string) error // 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(text string, data []byte) error // Listen subscribes to the beam topic and returns a channel that will // receive events. Listen() (<-chan *v1.ChannelMessage, error) // Close closes the channel. Close() error }
Channel is a pubsub based Key-Value store for Libp2p nodes.
type Option ¶
type Option func(*options)
Option is a function that modifies the beam options.
func WithCapacity ¶
WithCapacity sets the capacity of the beam store.
Click to show internal directories.
Click to hide internal directories.