pubsub

package
v0.0.0-...-b72ebd3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer interface {
	Consume() (interface{}, bool)
	Peek() Stat
	Scrub()
	X() circuit.X
}

type Loss

type Loss struct {
	Count int
}

Loss is a special value used in place of a contiguous set of lost messages

type LossyRing

type LossyRing struct {
	sync.Mutex
	// contains filtered or unexported fields
}

LossyRing

func MakeLossyRing

func MakeLossyRing(capacity int) *LossyRing

MakeLossyRing

func (*LossyRing) Clear

func (s *LossyRing) Clear(capacity int) *LossyRing

Clear

func (*LossyRing) Len

func (s *LossyRing) Len() int

func (*LossyRing) Recv

func (s *LossyRing) Recv() (v interface{}, ok bool)

func (*LossyRing) Send

func (s *LossyRing) Send(v interface{}) (noloss bool)

Send returns true if and only if the message was stored in the ring.

type PubSub

type PubSub struct {
	// contains filtered or unexported fields
}

PubSub…

func New

func New(name string, sum Summarize) (ps *PubSub)

func (*PubSub) Close

func (ps *PubSub) Close()

Close terminates, paradoxically, the infinite update stream.

func (*PubSub) Publish

func (ps *PubSub) Publish(v interface{})

Publish appends a value onto the infinite update stream.

func (*PubSub) Source

func (ps *PubSub) Source() string

Source returns the name of the event source.

func (*PubSub) Subscribe

func (ps *PubSub) Subscribe() *Subscription

Subscribe creates a new subscription object, whose interface embodies reading from an infinite stream. New subscription can join at any time. The input stream of each individual subscription is pre-loaded with a sequence of values summarizing all past history. Subsequent values come from the pubish stream. Subscriptions are abandoned on garbage-collection.

type Stat

type Stat struct {
	Source  string
	Pending int
	Closed  bool
}

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

Subscription is the user's interface to consuming messages from a topic.

func (*Subscription) Consume

func (s *Subscription) Consume() (interface{}, bool)

func (*Subscription) Peek

func (s *Subscription) Peek() Stat

func (*Subscription) Scrub

func (s *Subscription) Scrub()

func (*Subscription) X

func (s *Subscription) X() circuit.X

type Summarize

type Summarize func() []interface{}

Summarize returns a list of items meant to summarize the history of the stream so far for subscribers joining now.

type YSubscription

type YSubscription struct {
	X circuit.X
}

YSubscription is a client wrapper for cross-interface to *Subscription

func (YSubscription) Consume

func (y YSubscription) Consume() (interface{}, bool)

func (YSubscription) IsDone

func (y YSubscription) IsDone() bool

func (YSubscription) Peek

func (y YSubscription) Peek() Stat

func (YSubscription) Scrub

func (y YSubscription) Scrub()

Jump to

Keyboard shortcuts

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