pubsub

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	// Publish publishes a patchset to a channel.
	Publish(ctx context.Context, channel string, patchset ...dom.Patch) error
	// Subscribe subscribes to a channel.
	Subscribe(ctx context.Context, channel string) (Subscription, error)
	// HasSubscribers returns true if there are subscribers to the given pattern.
	HasSubscribers(ctx context.Context, pattern string) bool
}

Adapter is an interface for a pubsub adapter. It allows to publish and subscribe []dom.Patch to views.

func NewInmem

func NewInmem() Adapter

NewInmem creates a new in-memory pubsub adapter.s

func NewRedis

func NewRedis(client *redis.Client) Adapter

NewRedis creates a new redis pubsub adapter.

type Subscription

type Subscription interface {
	// C returns a receive-only go channel of patches published
	C() <-chan []dom.Patch
	// Close closes the subscription.
	Close()
}

Subscription is a subscription to a channel.

Jump to

Keyboard shortcuts

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