exocom

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseServiceData added in v0.27.0

func ParseServiceData(data string) (types.Routes, error)

ParseServiceData parses the incoming routes

Types

type ExoCom

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

ExoCom is the top level message broadcaster

func New

func New(serviceRoutes types.Routes) (*ExoCom, error)

New creates a new ExoCom instance

func (*ExoCom) Close

func (e *ExoCom) Close() error

Close closes the server

func (*ExoCom) Listen

func (e *ExoCom) Listen(port int) error

Listen opens a server on the given port

type Logger

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

Logger prints messages to the a io.Writer

func NewLogger

func NewLogger(writer io.Writer) *Logger

NewLogger returns a new Logger

func (*Logger) Error

func (l *Logger) Error(text string) error

Error prints the given text in red followed by a newline

func (*Logger) Header

func (l *Logger) Header(text string) error

Header prints the given text in faint (decreased intensity, in contrast to bold which is increased intensity) followed by a newline

func (*Logger) Log

func (l *Logger) Log(text string) error

Log prints the given text followed by a newline

func (*Logger) Messages

func (l *Logger) Messages(message structs.Message, receiverMapping types.ReceiverMapping) error

Messages prints the given messages and who they were sent to

func (*Logger) Warning

func (l *Logger) Warning(text string) error

Warning prints the given text in yellow followed by a newline

func (*Logger) Write

func (l *Logger) Write(text string) error

Write prints the given text

type MessageCache

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

MessageCache records the timestamp of each message. The cache automatically deletes any message older then 1 minute

func NewMessageCache

func NewMessageCache(cleanupInterval time.Duration) *MessageCache

NewMessageCache returns a new MessageCache removing old messages with a frequency equal to the given duration

func (*MessageCache) Get

func (c *MessageCache) Get(activityID string) (time.Time, bool)

Get returns the timestamp for the given activityId and whether or not data exists for that messageId

func (*MessageCache) Set

func (c *MessageCache) Set(activityID string, timestamp time.Time)

Set adds the given activityId and timestamp to the cache

Jump to

Keyboard shortcuts

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