Documentation ¶
Index ¶
- type Config
- type ConsoleOutput
- type GeoSubscription
- func NewGeoSubscription(subscription model.Subscription, index index.TriaIndex, store store.Store) GeoSubscription
- func NewGeoSubscriptionFromModel(geoSubscription model.GeoSubscription, store store.Store) GeoSubscription
- func NewGeoSubscriptionWithMovements(subscription model.Subscription, index index.TriaIndex, store store.Store, ...) GeoSubscription
- func (geoSubscription *GeoSubscription) ContainsAnyMovements(movementTypes sub.MovementList) bool
- func (geoSubscription *GeoSubscription) FindShapesWhichContainsPoint(position model.Position) []geometry.Shape
- func (geoSubscription *GeoSubscription) GetOutputPayloadFromEvent(message interface{}) (outputPayload, error)
- func (geoSubscription *GeoSubscription) SetAndDiffMovement(position model.Position, shapes []geometry.Shape) []*TrackerMovement
- func (geoSubscription *GeoSubscription) SubscribedToPrecision(precision float64) bool
- type Output
- type TrackerMovement
- type WebsocketOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config map[string]interface{}
Config is a config map containing an output configuration
func (*Config) GetIntWithDefault ¶
GetIntWithDefault gets a string value from output if present, otherwise returns default value
func (*Config) GetStringWithDefault ¶
GetStringWithDefault gets a string value from output if present, otherwise returns default value
type ConsoleOutput ¶
type ConsoleOutput struct {
// contains filtered or unexported fields
}
ConsoleOutput is a dummy output which simply prints to console whenever a subscription matches.
func NewConsoleOutput ¶
func NewConsoleOutput(geoSubscription GeoSubscription, eventCallback func(topic topic.Topic, event event.PublishableEvent)) *ConsoleOutput
NewConsoleOutput creates a new console output
func (*ConsoleOutput) Start ¶
func (consoleOutput *ConsoleOutput) Start(config Config, message <-chan interface{})
Start initiate start of the console outpt
func (*ConsoleOutput) Stop ¶
func (consoleOutput *ConsoleOutput) Stop(timeout time.Duration)
Stop initiate a stop of the console output
func (*ConsoleOutput) Validate ¶
func (consoleOutput *ConsoleOutput) Validate(config Config) error
Validate validates a console configuration
type GeoSubscription ¶
type GeoSubscription struct { Subscription model.Subscription Index index.TriaIndex MovementIndex movementIndex // contains filtered or unexported fields }
GeoSubscription contains everything needed to handle a subscription in memory
func NewGeoSubscription ¶
func NewGeoSubscription(subscription model.Subscription, index index.TriaIndex, store store.Store) GeoSubscription
NewGeoSubscription returns an initialized GeoSubscription with given params
func NewGeoSubscriptionFromModel ¶
func NewGeoSubscriptionFromModel(geoSubscription model.GeoSubscription, store store.Store) GeoSubscription
NewGeoSubscriptionFromModel creates a new GeoSubscription from a model. This will create both the movement index and general index for lookup
func NewGeoSubscriptionWithMovements ¶
func NewGeoSubscriptionWithMovements(subscription model.Subscription, index index.TriaIndex, store store.Store, movements []model.TrackerMovement) GeoSubscription
NewGeoSubscriptionWithMovements returns an initialized GeoSubscription with a populated movementIndex based on given movements
func (*GeoSubscription) ContainsAnyMovements ¶
func (geoSubscription *GeoSubscription) ContainsAnyMovements(movementTypes sub.MovementList) bool
ContainsAnyMovements checks if the subscription contains any of the given movement types
func (*GeoSubscription) FindShapesWhichContainsPoint ¶
func (geoSubscription *GeoSubscription) FindShapesWhichContainsPoint(position model.Position) []geometry.Shape
FindShapesWhichContainsPoint checks internal index if it contains a position
func (*GeoSubscription) GetOutputPayloadFromEvent ¶
func (geoSubscription *GeoSubscription) GetOutputPayloadFromEvent(message interface{}) (outputPayload, error)
GetOutputPayloadFromEvent parses the event message and applies the movements to the subscription. The outputPayload includes the movements and position. If the Position does not satisfy the subscription parameters, an empty outputPayload is returned
func (*GeoSubscription) SetAndDiffMovement ¶
func (geoSubscription *GeoSubscription) SetAndDiffMovement(position model.Position, shapes []geometry.Shape) []*TrackerMovement
SetAndDiffMovement diffs and updates the movements with the given shapes and returns a list of movements based on given input
func (*GeoSubscription) SubscribedToPrecision ¶
func (geoSubscription *GeoSubscription) SubscribedToPrecision(precision float64) bool
type Output ¶
type Output interface { // Start launches the output. This is non blocking, ie if the output // must connect to a remote server or perform some sort initialization it // will do so in a separate goroutine. The output will stop automatically // when the message channel is closed. If the message channel is closed // the output should attempt empty any remaining messages in the queue. Start(config Config, message <-chan interface{}) // Stop halts the output. Any buffered messages that can't be sent during // the timeout will be discarded by the output. When the Stop call returns // the output has stopped. Stop(timeout time.Duration) }
Output is the generic interface to create a working output for subscriptions
func NewOutput ¶
func NewOutput(geoSubscription GeoSubscription, eventCallback func(topic topic.Topic, event event.PublishableEvent)) (Output, error)
NewOutput initializes a new output
type TrackerMovement ¶
type TrackerMovement struct {
// contains filtered or unexported fields
}
TrackerMovement represents the last movements relative to a shape
func NewTrackerMovementFromModel ¶
func NewTrackerMovementFromModel(movement *model.TrackerMovement) *TrackerMovement
NewTrackerMovementFromModel create a TrackerMovement struct based on model input
func NewTrackerMovementListFromModel ¶
func NewTrackerMovementListFromModel(trackerMovementList []model.TrackerMovement) []*TrackerMovement
NewTrackerMovementListFromMdel creates a TrackerMovement list from a model TrackerMovement list
func (*TrackerMovement) DiffMovement ¶
func (trackerMovement *TrackerMovement) DiffMovement(inside bool) sub.MovementList
DiffMovement returns a MovementTypes based on param which represents that an entity is now inside shape or not
type WebsocketOutput ¶
type WebsocketOutput struct {
// contains filtered or unexported fields
}
WebsocketOutput is a simple output to enable the subscription on the /stream-endpoint of a subscription
func NewWebsocketOutput ¶
func NewWebsocketOutput(geoSubscription GeoSubscription, eventCallback func(topic topic.Topic, event event.PublishableEvent)) *WebsocketOutput
NewWebsocketOutput creates a new console output
func (*WebsocketOutput) Start ¶
func (websocketOutput *WebsocketOutput) Start(config Config, message <-chan interface{})
Start initiate start of the console outpt
func (*WebsocketOutput) Stop ¶
func (websocketOutput *WebsocketOutput) Stop(timeout time.Duration)
Stop initiate a stop of the console output
func (*WebsocketOutput) Validate ¶
func (websocketOutput *WebsocketOutput) Validate(config Config) error
Validate validates a console configuration