client

package
v0.0.0-...-82a8845 Latest Latest
Warning

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

Go to latest
Published: May 10, 2016 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NamespaceUUID = uuidlib.FromStringOrNil("85ce106e-0ccf-11e6-81fc-0cc47a0f7eea")

Functions

func ManyColumnCSV

func ManyColumnCSV(allLatencies [][]float64, filename string)

func UUIDFromName

func UUIDFromName(name string) common.UUID

Creates a deterministic UUID from a given name. Names are easier to remember than UUIDs, so this should make writing scripts easier

Types

type BrokerConnection

type BrokerConnection struct {
	// Handling the connection to the local broker
	// the IP:Port of the local broker we talk to
	BrokerAddrStr string
	BrokerAddress *net.TCPAddr

	// the IP:Port of the coordinator that we fall back to
	CoordinatorAddress *net.TCPAddr

	// signals on this channel when it is done
	Stop chan bool
	// contains filtered or unexported fields
}

func (*BrokerConnection) Start

func (bc *BrokerConnection) Start()

func (*BrokerConnection) StopIn

func (bc *BrokerConnection) StopIn(d time.Duration)

after the duration expires, stop the client by signalling on c.Stop

type Client

type Client struct {
	BrokerConnection
	// unique client identifier
	ID common.UUID
	// contains filtered or unexported fields
}

func NewClient

func NewClient(clientID common.UUID, query string, cfg *Config) (c *Client, err error)

Creates a new client with the given configuration

func (*Client) AttachDiffHandler

func (c *Client) AttachDiffHandler(f func(m *common.SubscriptionDiffMessage))

func (*Client) AttachPublishHandler

func (c *Client) AttachPublishHandler(f func(m *common.PublishMessage))

This function is called whenever the client receives a published message

type Config

type Config struct {
	// ip:port of the initial, local broker
	BrokerAddress string
	// ip:port of the coordinator
	CoordinatorAddress string
}

configuration for a client

type Publisher

type Publisher struct {
	BrokerConnection
	ID common.UUID
	// contains filtered or unexported fields
}

func NewPublisher

func NewPublisher(id common.UUID, publishLoop func(*Publisher), cfg *Config) (p *Publisher, err error)

publishLoop should be a loop which will start whenever a connection to a broker is established; it should exit whenever an error is encountered and it will be restarted once a reconnection is reestablished

func (*Publisher) AddMetadata

func (p *Publisher) AddMetadata(newm map[string]interface{})

func (*Publisher) GetStats

func (p *Publisher) GetStats() PublisherStats

func (*Publisher) Publish

func (p *Publisher) Publish(value interface{}) error

type PublisherStats

type PublisherStats struct {
	MessagesAttempted  uint32
	MessagesSuccessful uint32
}

type SimulatedBroker

type SimulatedBroker struct {
	// the IP:Port of the coordinator that we talk to
	CoordinatorAddress *net.TCPAddr

	// signals on this channel when it is done
	Stop chan bool
	// contains filtered or unexported fields
}

func NewSimulatedBroker

func NewSimulatedBroker(connectCallback func(*SimulatedBroker), errorCallback func(), msgHandler func(common.Sendable), id common.UUID,
	coordAddr string) (sb *SimulatedBroker, err error)

func (*SimulatedBroker) Send

func (bc *SimulatedBroker) Send(m common.Sendable) error

func (*SimulatedBroker) Start

func (bc *SimulatedBroker) Start()

func (*SimulatedBroker) StopIn

func (bc *SimulatedBroker) StopIn(d time.Duration)

after the duration expires, stop the client by signalling on c.Stop

Directories

Path Synopsis
This client measures the forwarding latency by running both a publisher and a subscriber and measuring the time for operations.
This client measures the forwarding latency by running both a publisher and a subscriber and measuring the time for operations.

Jump to

Keyboard shortcuts

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