broker

package
v0.0.0-...-b2761b6 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2014 License: GPL-3.0, GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package broker handles session registrations and delivery of messages through sessions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastExchange

type BroadcastExchange struct {
	ChanId               store.InternalChannelId
	TopLevel             int64
	NotificationPayloads []json.RawMessage
}

BroadcastExchange leads a session through delivering a BROADCAST. For simplicity it is fully public.

func (*BroadcastExchange) Acked

func (sbe *BroadcastExchange) Acked(sess BrokerSession, done bool) error

Acked deals with an ACK for a BROADCAST.

func (*BroadcastExchange) Prepare

func (sbe *BroadcastExchange) Prepare(sess BrokerSession) (outMessage protocol.SplittableMsg, inMessage interface{}, err error)

Prepare session for a BROADCAST.

type Broker

type Broker interface {
	// Register the session.
	Register(*protocol.ConnectMsg) (BrokerSession, error)
	// Unregister the session.
	Unregister(BrokerSession)
}

Broker is responsible for registring sessions and delivering messages through them.

type BrokerConfig

type BrokerConfig interface {
	// SessionQueueSize gives the session queue size.
	SessionQueueSize() uint
	// BrokerQueueSize gives the internal broker queue size.
	BrokerQueueSize() uint
}

BrokerConfig gives access to the typical broker configuration.

type BrokerSending

type BrokerSending interface {
	// Broadcast channel.
	Broadcast(chanId store.InternalChannelId)
}

BrokerSending is the notification sending facet of the broker.

type BrokerSession

type BrokerSession interface {
	// SessionChannel returns the session control channel
	// on which the session gets exchanges to perform.
	SessionChannel() <-chan Exchange
	// DeviceIdentifier returns the device id string.
	DeviceIdentifier() string
	// Levels returns the current channel levels for the session
	Levels() LevelsMap
	// ExchangeScratchArea returns the scratch area for exchanges.
	ExchangeScratchArea() *ExchangesScratchArea
}

BrokerSession holds broker session state.

type ErrAbort

type ErrAbort struct {
	Reason string
}

Session aborted error.

func (*ErrAbort) Error

func (ea *ErrAbort) Error() string

type Exchange

type Exchange interface {
	Prepare(sess BrokerSession) (outMessage protocol.SplittableMsg, inMessage interface{}, err error)
	Acked(sess BrokerSession, done bool) error
}

Exchange leads the session through performing an exchange, typically delivery.

type ExchangesScratchArea

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

Scratch area for exchanges, sessions should hold one of these.

type LevelsMap

type LevelsMap map[store.InternalChannelId]int64

LevelsMap is the type for holding channel levels for session.

Directories

Path Synopsis
Package simple implements a simple broker for just one process.
Package simple implements a simple broker for just one process.
Package testing contains simple test implementations of some broker interfaces.
Package testing contains simple test implementations of some broker interfaces.
Package testsuite contains a common test suite for brokers.
Package testsuite contains a common test suite for brokers.

Jump to

Keyboard shortcuts

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