common

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: 14 Imported by: 0

Documentation

Index

Constants

View Source
const AND = 57348
View Source
const EQ = 57352
View Source
const HAS = 57354
View Source
const KEY = 57355
View Source
const LIKE = 57351
View Source
const LPAREN = 57346
View Source
const NEQ = 57353
View Source
const NOT = 57350
View Source
const OR = 57349
View Source
const RPAREN = 57347
View Source
const VALUE = 57356

Variables

This section is empty.

Functions

func AssertSendableChanEmpty

func AssertSendableChanEmpty(assert *require.Assertions, channel chan Sendable)

func AssertStrEqual

func AssertStrEqual(assert *require.Assertions, a, b interface{})

Poor man's deep equality check because I can't get anything else to work

func GetMessageType

func GetMessageType(msg Sendable) string

func IsChanClosed

func IsChanClosed(channel chan bool) bool

func Parse

func Parse(querystring string) rootNode

func SetupLogging

func SetupLogging(config *Config)

func SetupTestLogging

func SetupTestLogging()

Types

type AcknowledgeMessage

type AcknowledgeMessage struct {
	MessageID MessageIDType
}

Used for communication between coordinator and brokers to confirm that a message was received. The sender should keep track of unacknowledged messages and remove them from some sort of buffer when an ack is received.

func (*AcknowledgeMessage) DecodeMsg

func (z *AcknowledgeMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*AcknowledgeMessage) Encode

func (m *AcknowledgeMessage) Encode(enc *msgp.Writer) error

func (AcknowledgeMessage) EncodeMsg

func (z AcknowledgeMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*AcknowledgeMessage) GetID

func (m *AcknowledgeMessage) GetID() MessageIDType

func (*AcknowledgeMessage) Marshal

func (m *AcknowledgeMessage) Marshal() ([]byte, error)

func (AcknowledgeMessage) MarshalMsg

func (z AcknowledgeMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (AcknowledgeMessage) Msgsize

func (z AcknowledgeMessage) Msgsize() (s int)

func (*AcknowledgeMessage) UnmarshalMsg

func (z *AcknowledgeMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BenchmarkConfig

type BenchmarkConfig struct {
	BrokerURL         string
	BrokerPort        int
	StepSpacing       int    // How long between increasing client/publisher counts (seconds)
	ConfigurationName string // Named bundle of query/metadata
}

type BrokerAssignmentMessage

type BrokerAssignmentMessage struct {
	// the ID and address of the failover broker: "ip:port"
	BrokerInfo
}

Sent from coordinator -> clients/publishers to let them know which failover broker they should contact

func (*BrokerAssignmentMessage) DecodeMsg

func (z *BrokerAssignmentMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BrokerAssignmentMessage) Encode

func (m *BrokerAssignmentMessage) Encode(enc *msgp.Writer) error

func (*BrokerAssignmentMessage) EncodeMsg

func (z *BrokerAssignmentMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BrokerAssignmentMessage) Marshal

func (m *BrokerAssignmentMessage) Marshal() ([]byte, error)

func (*BrokerAssignmentMessage) MarshalMsg

func (z *BrokerAssignmentMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BrokerAssignmentMessage) Msgsize

func (z *BrokerAssignmentMessage) Msgsize() (s int)

func (*BrokerAssignmentMessage) UnmarshalMsg

func (z *BrokerAssignmentMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BrokerConnectMessage

type BrokerConnectMessage struct {
	MessageIDStruct
	BrokerInfo // its own ID and where incoming requests should be routed to
}

Sent from broker -> Coordinator whenever a broker comes online

func (*BrokerConnectMessage) Copy

func (*BrokerConnectMessage) DecodeMsg

func (z *BrokerConnectMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BrokerConnectMessage) Encode

func (m *BrokerConnectMessage) Encode(enc *msgp.Writer) error

func (*BrokerConnectMessage) EncodeMsg

func (z *BrokerConnectMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BrokerConnectMessage) Marshal

func (m *BrokerConnectMessage) Marshal() ([]byte, error)

func (*BrokerConnectMessage) MarshalMsg

func (z *BrokerConnectMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BrokerConnectMessage) Msgsize

func (z *BrokerConnectMessage) Msgsize() (s int)

func (*BrokerConnectMessage) UnmarshalMsg

func (z *BrokerConnectMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BrokerDeathMessage

type BrokerDeathMessage struct {
	MessageIDStruct
	BrokerInfo
}

Sent from coordinator -> all brokers when it determines that a broker is offline, notifying other brokers they should stop attempting to forward to that broker

func (*BrokerDeathMessage) Copy

func (*BrokerDeathMessage) DecodeMsg

func (z *BrokerDeathMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BrokerDeathMessage) Encode

func (m *BrokerDeathMessage) Encode(enc *msgp.Writer) error

func (*BrokerDeathMessage) EncodeMsg

func (z *BrokerDeathMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BrokerDeathMessage) Marshal

func (m *BrokerDeathMessage) Marshal() ([]byte, error)

func (*BrokerDeathMessage) MarshalMsg

func (z *BrokerDeathMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BrokerDeathMessage) Msgsize

func (z *BrokerDeathMessage) Msgsize() (s int)

func (*BrokerDeathMessage) UnmarshalMsg

func (z *BrokerDeathMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BrokerInfo

type BrokerInfo struct {
	BrokerID         UUID
	ClientBrokerAddr string // "ip:port" to be contacted at
	CoordBrokerAddr  string // "ip:port" to be contacted at
}

func (*BrokerInfo) DecodeMsg

func (z *BrokerInfo) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (BrokerInfo) EncodeMsg

func (z BrokerInfo) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (BrokerInfo) MarshalMsg

func (z BrokerInfo) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BrokerInfo) Msgsize

func (z BrokerInfo) Msgsize() (s int)

func (*BrokerInfo) UnmarshalMsg

func (z *BrokerInfo) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BrokerPublishMessage

type BrokerPublishMessage struct {
	MessageIDStruct
	UUID     UUID
	Metadata map[string]interface{}
	Value    interface{}
	L        sync.RWMutex `msg:"-"`
}

Analogous to PublishMessage, but used for internal communication, i.e. when a broker forwards a PublishMessage to another broker

func (*BrokerPublishMessage) Copy

func (*BrokerPublishMessage) DecodeMsg

func (z *BrokerPublishMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BrokerPublishMessage) Encode

func (m *BrokerPublishMessage) Encode(enc *msgp.Writer) error

func (*BrokerPublishMessage) EncodeMsg

func (z *BrokerPublishMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BrokerPublishMessage) FromPublishMessage

func (m *BrokerPublishMessage) FromPublishMessage(pm *PublishMessage)

func (*BrokerPublishMessage) Marshal

func (m *BrokerPublishMessage) Marshal() ([]byte, error)

func (*BrokerPublishMessage) MarshalMsg

func (z *BrokerPublishMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BrokerPublishMessage) Msgsize

func (z *BrokerPublishMessage) Msgsize() (s int)

func (*BrokerPublishMessage) ToRegular

func (m *BrokerPublishMessage) ToRegular() *PublishMessage

func (*BrokerPublishMessage) UnmarshalMsg

func (z *BrokerPublishMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BrokerQueryMessage

type BrokerQueryMessage struct {
	MessageIDStruct
	Query string
	UUID  UUID
}

Analogous to QueryMessage, but used when sending messages from brokers to the coordinator so that it is possible to tell which client the query is attached to

func (*BrokerQueryMessage) Copy

func (*BrokerQueryMessage) DecodeMsg

func (z *BrokerQueryMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BrokerQueryMessage) Encode

func (m *BrokerQueryMessage) Encode(enc *msgp.Writer) error

func (*BrokerQueryMessage) EncodeMsg

func (z *BrokerQueryMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BrokerQueryMessage) Marshal

func (m *BrokerQueryMessage) Marshal() ([]byte, error)

func (*BrokerQueryMessage) MarshalMsg

func (z *BrokerQueryMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BrokerQueryMessage) Msgsize

func (z *BrokerQueryMessage) Msgsize() (s int)

func (*BrokerQueryMessage) UnmarshalMsg

func (z *BrokerQueryMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BrokerRequestMessage

type BrokerRequestMessage struct {
	// this is the broker that clients are expecting
	// They send it to Coordinator so that when this broker comes back online,
	// it knows which clients to inform to reconnect
	// "ip:port"
	LocalBrokerAddr string
	IsPublisher     bool // false if a client
	UUID            UUID // UUID of client or publisher
}

Sent from clients / publishers -> coordinator when they cannot contact their local/home broker

func (*BrokerRequestMessage) DecodeMsg

func (z *BrokerRequestMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BrokerRequestMessage) Encode

func (m *BrokerRequestMessage) Encode(enc *msgp.Writer) error

func (BrokerRequestMessage) EncodeMsg

func (z BrokerRequestMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BrokerRequestMessage) Marshal

func (m *BrokerRequestMessage) Marshal() ([]byte, error)

func (BrokerRequestMessage) MarshalMsg

func (z BrokerRequestMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BrokerRequestMessage) Msgsize

func (z BrokerRequestMessage) Msgsize() (s int)

func (*BrokerRequestMessage) UnmarshalMsg

func (z *BrokerRequestMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BrokerSubscriptionDiffMessage

type BrokerSubscriptionDiffMessage struct {
	MessageIDStruct
	NewPublishers []UUID
	DelPublishers []UUID
	Query         string
}

Analogous to SubscriptionDiffMessage, but used for internal comm., i.e. when coordinator notifies a broker to talk to its client

func (*BrokerSubscriptionDiffMessage) Copy

func (*BrokerSubscriptionDiffMessage) DecodeMsg

func (z *BrokerSubscriptionDiffMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BrokerSubscriptionDiffMessage) Encode

func (*BrokerSubscriptionDiffMessage) EncodeMsg

func (z *BrokerSubscriptionDiffMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BrokerSubscriptionDiffMessage) FromProducerState

func (m *BrokerSubscriptionDiffMessage) FromProducerState(state map[UUID]ProducerState)

func (*BrokerSubscriptionDiffMessage) Marshal

func (m *BrokerSubscriptionDiffMessage) Marshal() ([]byte, error)

func (*BrokerSubscriptionDiffMessage) MarshalMsg

func (z *BrokerSubscriptionDiffMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BrokerSubscriptionDiffMessage) Msgsize

func (z *BrokerSubscriptionDiffMessage) Msgsize() (s int)

func (*BrokerSubscriptionDiffMessage) UnmarshalMsg

func (z *BrokerSubscriptionDiffMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BrokerTerminateMessage

type BrokerTerminateMessage struct {
	MessageIDStruct
}

Sent from broker -> coordinator if it is going offline permanently

func (*BrokerTerminateMessage) Copy

func (*BrokerTerminateMessage) DecodeMsg

func (z *BrokerTerminateMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*BrokerTerminateMessage) Encode

func (m *BrokerTerminateMessage) Encode(enc *msgp.Writer) error

func (*BrokerTerminateMessage) EncodeMsg

func (z *BrokerTerminateMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*BrokerTerminateMessage) Marshal

func (m *BrokerTerminateMessage) Marshal() ([]byte, error)

func (*BrokerTerminateMessage) MarshalMsg

func (z *BrokerTerminateMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*BrokerTerminateMessage) Msgsize

func (z *BrokerTerminateMessage) Msgsize() (s int)

func (*BrokerTerminateMessage) UnmarshalMsg

func (z *BrokerTerminateMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type CancelForwardRequest

type CancelForwardRequest struct {
	MessageIDStruct
	// list of publishers whose messages should be cancelled
	PublisherList []UUID
	// the query that has been cancelled
	Query string
	// Necessary so you know who you need to stop forwarding to, since you
	// may be forwarding to multiple brokers for the same query
	BrokerInfo
}

Sent from coordinator -> brokers to cancel the forwarding route created by a ForwardRequest; used when clients cancel their subscription/disappear

func (*CancelForwardRequest) Copy

func (*CancelForwardRequest) DecodeMsg

func (z *CancelForwardRequest) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*CancelForwardRequest) Encode

func (m *CancelForwardRequest) Encode(enc *msgp.Writer) error

func (*CancelForwardRequest) EncodeMsg

func (z *CancelForwardRequest) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*CancelForwardRequest) Marshal

func (m *CancelForwardRequest) Marshal() ([]byte, error)

func (*CancelForwardRequest) MarshalMsg

func (z *CancelForwardRequest) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*CancelForwardRequest) Msgsize

func (z *CancelForwardRequest) Msgsize() (s int)

func (*CancelForwardRequest) UnmarshalMsg

func (z *CancelForwardRequest) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientTerminationMessage

type ClientTerminationMessage struct {
	MessageIDStruct
	// the client that has left
	ClientID UUID
}

Sent from broker -> coordinator when a client connection / subscription is terminated

func (*ClientTerminationMessage) Copy

func (*ClientTerminationMessage) DecodeMsg

func (z *ClientTerminationMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientTerminationMessage) Encode

func (m *ClientTerminationMessage) Encode(enc *msgp.Writer) error

func (*ClientTerminationMessage) EncodeMsg

func (z *ClientTerminationMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientTerminationMessage) Marshal

func (m *ClientTerminationMessage) Marshal() ([]byte, error)

func (*ClientTerminationMessage) MarshalMsg

func (z *ClientTerminationMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientTerminationMessage) Msgsize

func (z *ClientTerminationMessage) Msgsize() (s int)

func (*ClientTerminationMessage) UnmarshalMsg

func (z *ClientTerminationMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ClientTerminationRequest

type ClientTerminationRequest struct {
	MessageIDStruct
	// "ip:port"
	ClientIDs []UUID
}

**** ClientTerminationRequest **** Sent from coordinator -> broker when coordinator wants the broker to break the connection with a specific client (i.e., when the broker is a failover and the local broker comes back online)

func (*ClientTerminationRequest) Copy

func (*ClientTerminationRequest) DecodeMsg

func (z *ClientTerminationRequest) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ClientTerminationRequest) Encode

func (m *ClientTerminationRequest) Encode(enc *msgp.Writer) error

func (*ClientTerminationRequest) EncodeMsg

func (z *ClientTerminationRequest) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ClientTerminationRequest) Marshal

func (m *ClientTerminationRequest) Marshal() ([]byte, error)

func (*ClientTerminationRequest) MarshalMsg

func (z *ClientTerminationRequest) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ClientTerminationRequest) Msgsize

func (z *ClientTerminationRequest) Msgsize() (s int)

func (*ClientTerminationRequest) UnmarshalMsg

func (z *ClientTerminationRequest) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Clock

type Clock interface {
	Now() time.Time
	Sleep(d time.Duration)
	After(d time.Duration) <-chan time.Time
}

type Config

type Config struct {
	Logging     LoggingConfig
	Server      ServerConfig
	Mongo       MongoConfig
	Coordinator CoordinatorConfig
	Debug       DebugConfig
	Benchmark   BenchmarkConfig
}

func LoadConfig

func LoadConfig(filename string) (config *Config, logmsg string)

Don't want to log anything since this is called before SetupLogging; return the desired log message to be logged later if desired TODO this makes it so that default_config.ini overwrites config.ini...

type CoordinatorConfig

type CoordinatorConfig struct {
	Port                          int
	Global                        bool
	HeartbeatInterval             int    // seconds
	CoordinatorCount              int    // number of coordinators total
	EtcdAddresses                 string // comma-separated list
	GCFreq                        int    // how often (number of events) to GC etcd
	EnableContinuousCheckpointing bool   // true to continuously checkpoint
	DisableSendLog                bool   // true to not log sent messages
	UseAWSIPSwitcher              bool   // true to use the AWP IP Switcher; doesn't switch IPs otherwise
	UseEtcd                       bool   // true if events should be stored in Etcd; CoordinatorCount must be 1
	InstanceId                    string // AWS instance id, e.g. i-1a2b3c4d
	Region                        string // AWS region name, e.g. us-west-1
	ElasticIP                     string // the elastic IP to fight over
}

Coordinator configuration

type DebugConfig

type DebugConfig struct {
	Enable        bool
	ProfileType   string
	ProfileLength int
}

Debugging configuration

type FakeClock

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

func NewFakeClock

func NewFakeClock(initialTime time.Time) *FakeClock

func (*FakeClock) AdvanceNowTime

func (fc *FakeClock) AdvanceNowTime(length time.Duration)

func (*FakeClock) After

func (fc *FakeClock) After(d time.Duration) <-chan time.Time

func (*FakeClock) Now

func (fc *FakeClock) Now() time.Time

func (*FakeClock) SetNowTime

func (fc *FakeClock) SetNowTime(nowTime time.Time)

func (*FakeClock) Sleep

func (fc *FakeClock) Sleep(d time.Duration)

type ForwardRequestMessage

type ForwardRequestMessage struct {
	MessageIDStruct
	// list of publishers whose messages should be forwarded
	PublisherList []UUID
	// the destination broker
	BrokerInfo
	// the query string which defines this forward request
	Query string
}

Sent from coordinator -> brokers to tell the broker to create a forwarding route from one broker to another

func (*ForwardRequestMessage) Copy

func (*ForwardRequestMessage) DecodeMsg

func (z *ForwardRequestMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ForwardRequestMessage) Encode

func (m *ForwardRequestMessage) Encode(enc *msgp.Writer) error

func (*ForwardRequestMessage) EncodeMsg

func (z *ForwardRequestMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ForwardRequestMessage) Marshal

func (m *ForwardRequestMessage) Marshal() ([]byte, error)

func (*ForwardRequestMessage) MarshalMsg

func (z *ForwardRequestMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ForwardRequestMessage) Msgsize

func (z *ForwardRequestMessage) Msgsize() (s int)

func (*ForwardRequestMessage) UnmarshalMsg

func (z *ForwardRequestMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type HeartbeatMessage

type HeartbeatMessage struct{}

func (*HeartbeatMessage) Encode

func (m *HeartbeatMessage) Encode(enc *msgp.Writer) error

func (*HeartbeatMessage) Marshal

func (m *HeartbeatMessage) Marshal() ([]byte, error)

type LeaderChangeMessage

type LeaderChangeMessage struct{}

Used for the log only to mark that a leadership change occurred at that point in the log

func (*LeaderChangeMessage) Encode

func (m *LeaderChangeMessage) Encode(enc *msgp.Writer) error

func (*LeaderChangeMessage) Marshal

func (m *LeaderChangeMessage) Marshal() ([]byte, error)

type Lexer

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

func (*Lexer) Error

func (l *Lexer) Error(s string)

func (*Lexer) Lex

func (l *Lexer) Lex(lval *cqbsSymType) int

type LoggingConfig

type LoggingConfig struct {
	// whether or not log outputs in JSON
	UseJSON bool
	Level   string
}

configuration for the logging

type Message

type Message interface {
	GetID() MessageIDType
}

type MessageIDStruct

type MessageIDStruct struct {
	MessageID MessageIDType
}

func GetMessageIDStruct

func GetMessageIDStruct() MessageIDStruct

func (*MessageIDStruct) DecodeMsg

func (z *MessageIDStruct) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (MessageIDStruct) EncodeMsg

func (z MessageIDStruct) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*MessageIDStruct) GetID

func (sendable *MessageIDStruct) GetID() MessageIDType

func (MessageIDStruct) MarshalMsg

func (z MessageIDStruct) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageIDStruct) Msgsize

func (z MessageIDStruct) Msgsize() (s int)

func (*MessageIDStruct) SetID

func (sendable *MessageIDStruct) SetID(id MessageIDType)

func (*MessageIDStruct) UnmarshalMsg

func (z *MessageIDStruct) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageIDType

type MessageIDType uint32

func GetMessageID

func GetMessageID() MessageIDType

func (*MessageIDType) DecodeMsg

func (z *MessageIDType) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (MessageIDType) EncodeMsg

func (z MessageIDType) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (MessageIDType) MarshalMsg

func (z MessageIDType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageIDType) Msgsize

func (z MessageIDType) Msgsize() (s int)

func (*MessageIDType) UnmarshalMsg

func (z *MessageIDType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MessageType

type MessageType uint8
const (
	// External messages
	PUBLISHMSG MessageType = iota
	QUERYMSG
	SUBSCRIPDIFFMSG
	BROKERREQUESTMSG

	// Internal messages
	BROKERCONNECTMSG
	FORWARDREQUESTMSG
	CANCELFORWARDREQUESTMSG
	BROKERSUBSCRIPDIFFMSG
	BROKERASSIGNMSG
	BROKERDEATHMSG
	CLIENTTERMREQUESTMSG
	PUBTERMREQUESTMSG
	REQHEARTBEATMSG
	HEARTBEATMSG
	BROKERPUBLISHMSG
	BROKERQUERYMSG
	CLIENTTERMMSG
	PUBTERMMSG
	BROKERTERMMSG
	ACKMSG

	LEADERCHANGEMSG
)

func (*MessageType) DecodeMsg

func (z *MessageType) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (MessageType) EncodeMsg

func (z MessageType) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (MessageType) MarshalMsg

func (z MessageType) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (MessageType) Msgsize

func (z MessageType) Msgsize() (s int)

func (*MessageType) UnmarshalMsg

func (z *MessageType) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type MetadataStore

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

This struct handles all communication with the Mongo database that provides metadata storage and query capabilities. The "schema" of the metadata collection is simple. Each document is flat (just k-v pairs) and corresponds to a producer. The producer UUIDv4 is stored in the primary key _id field, and the rest of the document is just the key/value pairs of metadata

func NewMetadataStore

func NewMetadataStore(c *Config) *MetadataStore

func (*MetadataStore) DropDatabase

func (ms *MetadataStore) DropDatabase()

Obviously use carefully - in place only for testing!

func (*MetadataStore) Query

func (ms *MetadataStore) Query(node rootNode) (*Query, error)

func (*MetadataStore) Reevaluate

func (ms *MetadataStore) Reevaluate(query *Query) (added, removed []UUID)

func (*MetadataStore) RemovePublisher

func (ms *MetadataStore) RemovePublisher(uuid UUID) error

func (*MetadataStore) Save

func (ms *MetadataStore) Save(publisherID *UUID, metadata map[string]interface{}) error

type MongoConfig

type MongoConfig struct {
	Port     int
	Host     string
	Database string
}

MongoDB configuration

type Node

type Node interface {
	// generates the mongo query for this node
	MongoQuery() bson.M
}

type ProducerState

type ProducerState uint
const (
	ProdStateOld ProducerState = iota
	ProdStateNew
	ProdStateSame
)

func (*ProducerState) DecodeMsg

func (z *ProducerState) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (ProducerState) EncodeMsg

func (z ProducerState) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (ProducerState) MarshalMsg

func (z ProducerState) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (ProducerState) Msgsize

func (z ProducerState) Msgsize() (s int)

func (*ProducerState) UnmarshalMsg

func (z *ProducerState) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PublishMessage

type PublishMessage struct {
	UUID     UUID
	Metadata map[string]interface{}
	Value    interface{}
	L        sync.RWMutex `msg:"-"`
}

func (*PublishMessage) DecodeMsg

func (z *PublishMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PublishMessage) Encode

func (m *PublishMessage) Encode(enc *msgp.Writer) error

func (*PublishMessage) EncodeMsg

func (z *PublishMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PublishMessage) FromArray

func (m *PublishMessage) FromArray(array []interface{}) error

func (*PublishMessage) FromBroker

func (m *PublishMessage) FromBroker(bpm *BrokerPublishMessage)

func (*PublishMessage) IsEmpty

func (m *PublishMessage) IsEmpty() bool

func (*PublishMessage) Marshal

func (m *PublishMessage) Marshal() ([]byte, error)

func (*PublishMessage) MarshalMsg

func (z *PublishMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PublishMessage) Msgsize

func (z *PublishMessage) Msgsize() (s int)

func (*PublishMessage) ToBroker

func (m *PublishMessage) ToBroker() *BrokerPublishMessage

func (*PublishMessage) UnmarshalMsg

func (z *PublishMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PublisherTerminationMessage

type PublisherTerminationMessage struct {
	MessageIDStruct
	// the publisher that has left
	PublisherID UUID
}

Sent from broker -> coordinator when a publisher connection is terminated

func (*PublisherTerminationMessage) Copy

func (*PublisherTerminationMessage) DecodeMsg

func (z *PublisherTerminationMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PublisherTerminationMessage) Encode

func (m *PublisherTerminationMessage) Encode(enc *msgp.Writer) error

func (*PublisherTerminationMessage) EncodeMsg

func (z *PublisherTerminationMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PublisherTerminationMessage) Marshal

func (m *PublisherTerminationMessage) Marshal() ([]byte, error)

func (*PublisherTerminationMessage) MarshalMsg

func (z *PublisherTerminationMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PublisherTerminationMessage) Msgsize

func (z *PublisherTerminationMessage) Msgsize() (s int)

func (*PublisherTerminationMessage) UnmarshalMsg

func (z *PublisherTerminationMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type PublisherTerminationRequest

type PublisherTerminationRequest struct {
	MessageIDStruct
	PublisherIDs []UUID
}

**** PublisherTerminationRequest **** Sent from coordinator -> broker when coordinator wants the broker to break the connection with a specific publisher (i.e., when the broker is a failover and the local broker comes back online)

func (*PublisherTerminationRequest) Copy

func (*PublisherTerminationRequest) DecodeMsg

func (z *PublisherTerminationRequest) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*PublisherTerminationRequest) Encode

func (m *PublisherTerminationRequest) Encode(enc *msgp.Writer) error

func (*PublisherTerminationRequest) EncodeMsg

func (z *PublisherTerminationRequest) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*PublisherTerminationRequest) Marshal

func (m *PublisherTerminationRequest) Marshal() ([]byte, error)

func (*PublisherTerminationRequest) MarshalMsg

func (z *PublisherTerminationRequest) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*PublisherTerminationRequest) Msgsize

func (z *PublisherTerminationRequest) Msgsize() (s int)

func (*PublisherTerminationRequest) UnmarshalMsg

func (z *PublisherTerminationRequest) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Query

type Query struct {
	QueryString       string
	Keys              []string
	MatchingProducers map[UUID]ProducerState
	Mongo             bson.M
	sync.RWMutex
}

func NewQuery

func NewQuery(query string, keys []string, root Node) *Query

type QueryMessage

type QueryMessage struct {
	UUID  UUID
	Query string
}

**** QueryMessage **** Client starts a query with this

func (*QueryMessage) DecodeMsg

func (z *QueryMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*QueryMessage) Encode

func (m *QueryMessage) Encode(enc *msgp.Writer) error

func (QueryMessage) EncodeMsg

func (z QueryMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*QueryMessage) Marshal

func (m *QueryMessage) Marshal() ([]byte, error)

func (QueryMessage) MarshalMsg

func (z QueryMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (QueryMessage) Msgsize

func (z QueryMessage) Msgsize() (s int)

func (*QueryMessage) UnmarshalMsg

func (z *QueryMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type RealClock

type RealClock struct{}

func (*RealClock) After

func (*RealClock) After(d time.Duration) <-chan time.Time

func (*RealClock) Now

func (*RealClock) Now() time.Time

func (*RealClock) Sleep

func (*RealClock) Sleep(d time.Duration)

type RequestHeartbeatMessage

type RequestHeartbeatMessage struct{}

func (*RequestHeartbeatMessage) Encode

func (m *RequestHeartbeatMessage) Encode(enc *msgp.Writer) error

func (*RequestHeartbeatMessage) Marshal

func (m *RequestHeartbeatMessage) Marshal() ([]byte, error)

type Sendable

type Sendable interface {
	Encode(enc *msgp.Writer) error
	Marshal() (o []byte, err error)
}

func MessageFromBytes

func MessageFromBytes(bytes []byte) (Sendable, error)

func MessageFromDecoderMsgp

func MessageFromDecoderMsgp(dec *msgp.Reader) (Sendable, error)

type SendableWithID

type SendableWithID interface {
	Encode(enc *msgp.Writer) error
	Marshal() (o []byte, err error)
	GetID() MessageIDType
	SetID(MessageIDType)
	Copy() SendableWithID
}

type ServerConfig

type ServerConfig struct {
	// if true, listens on 0.0.0.0
	Global bool
	// Client Interface
	Port int
	// the public-facing address of the broker
	Host string
	// A unique key for this Broker
	BrokerID UUID
	// the name of the coordinator server
	CoordinatorHost string
	// the port of the coordinator server
	CoordinatorPort int
	// if true, then the broker evaluates metadata locally
	// (distribution option #2). If false, then it forwards
	// queries to the coordinator (distribution option #1).
	// Note that if running in single-node mode, without
	// a coordinator, this must be TRUE.
	LocalEvaluation bool
}

server configuration

type SubscriptionDiffMessage

type SubscriptionDiffMessage map[string][]UUID

//////////////////////////////////// **** SubscriptionDiff Message **** ////////////////////////////////////

func (*SubscriptionDiffMessage) DecodeMsg

func (z *SubscriptionDiffMessage) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*SubscriptionDiffMessage) Encode

func (m *SubscriptionDiffMessage) Encode(enc *msgp.Writer) error

func (SubscriptionDiffMessage) EncodeMsg

func (z SubscriptionDiffMessage) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*SubscriptionDiffMessage) FromProducerState

func (m *SubscriptionDiffMessage) FromProducerState(state map[UUID]ProducerState)

func (*SubscriptionDiffMessage) Marshal

func (m *SubscriptionDiffMessage) Marshal() ([]byte, error)

func (SubscriptionDiffMessage) MarshalMsg

func (z SubscriptionDiffMessage) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (SubscriptionDiffMessage) Msgsize

func (z SubscriptionDiffMessage) Msgsize() (s int)

func (*SubscriptionDiffMessage) UnmarshalMsg

func (z *SubscriptionDiffMessage) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type UUID

type UUID string

func (*UUID) DecodeMsg

func (z *UUID) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (UUID) EncodeMsg

func (z UUID) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (UUID) MarshalMsg

func (z UUID) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (UUID) Msgsize

func (z UUID) Msgsize() (s int)

func (*UUID) UnmarshalMsg

func (z *UUID) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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