package pubsub

import "github.com/docker/docker/pkg/pubsub"

Index

Types

type Publisher

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

func NewPublisher

func NewPublisher(publishTimeout time.Duration, buffer int) *Publisher

NewPublisher creates a new pub/sub publisher to broadcast messages. The duration is used as the send timeout as to not block the publisher publishing messages to other clients if one client is slow or unresponsive. The buffer is used when creating new channels for subscribers.

func (*Publisher) Close

func (p *Publisher) Close()

Close closes the channels to all subscribers registered with the publisher.

func (*Publisher) Evict

func (p *Publisher) Evict(sub chan interface{})

Evict removes the specified subscriber from receiving any more messages.

func (*Publisher) Len

func (p *Publisher) Len() int

Len returns the number of subscribers for the publisher

func (*Publisher) Publish

func (p *Publisher) Publish(v interface{})

Publish sends the data in v to all subscribers currently registered with the publisher.

func (*Publisher) Subscribe

func (p *Publisher) Subscribe() chan interface{}

Subscribe adds a new subscriber to the publisher returning the channel.

Source Files

publisher.go

Version
v1.7.0-rc1
Published
May 28, 2015
Platform
linux/amd64
Imports
2 packages
Last checked
15 minutes ago

Tools for package owners.