eventpublisher

package
v0.0.0-...-9fbc374 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventPublisherInterface

type EventPublisherInterface interface {
	PublishTaskEvent(event TaskEvent) error
	PublishRobotEvent(event RobotEvent) error
}

EventPublisherInterface defines contract for event publishers

func NewEventPublisherService

func NewEventPublisherService(
	logger *zap.SugaredLogger,
	robotBrokerService robotbroker.RobotBrokerInterface) (EventPublisherInterface, error)

NewEventPublisherService creates a concerete instance of EventPublisherInterface

type MoveRobotRequestMoveSequence

type MoveRobotRequestMoveSequence string

MoveRobotRequestMoveSequence describes a movement code

const (
	// EAST denotes a movement code towards EAST
	EAST MoveRobotRequestMoveSequence = "E"
	// NORTH denotes a movement code towards NORTH
	NORTH MoveRobotRequestMoveSequence = "N"
	// SOUTH denotes a movement code towards SOUTH
	SOUTH MoveRobotRequestMoveSequence = "S"
	// WEST denotes a movement code towards WEST
	WEST MoveRobotRequestMoveSequence = "W"
)

type RobotData

type RobotData struct {
	X int `json:"X"`
	Y int `json:"Y"`
}

RobotData show robot's location on grid

type RobotEvent

type RobotEvent struct {
	EventType    RobotMovedEventType `json:"EventType"`
	Id           int64               `json:"Id"`
	Data         RobotData           `json:"Data,omitempty"`
	ErrorMessage string              `json:"ErrorMessage,omitempty"`
}

RobotEvent describe a RobotEvent

type RobotMovedEventType

type RobotMovedEventType string

RobotMovedEventType descries a robot movement event type

const (
	// RobotMoved is used when a RobotMoved
	RobotMoved RobotMovedEventType = "Moved"
	// RobotFailedToMove is used when a RobotFailedToMove
	RobotFailedToMove RobotMovedEventType = "FailedToMove"
)

type TaskData

type TaskData struct {
	RobotId        int64                          `json:"RobotId"`
	MoveSequeneces []MoveRobotRequestMoveSequence `json:"MoveSequeneces"`
}

TaskData describes task data

type TaskEvent

type TaskEvent struct {
	EventType TaskEventType `json:"EventType"`
	Id        int           `json:"Id"`
	Data      TaskData      `json:"Data,omitempty"`
}

TaskEvent describes a task event

type TaskEventType

type TaskEventType string

TaskEventType describe task state

const (
	// TaskCreated is used to denote a task event that is Created
	TaskCreated TaskEventType = "Created"
	// TaskCompleted is used to denote a task event that is Completed
	TaskCompleted TaskEventType = "Completed"
	// TaskCancelled is used to denote a task event that is Cancelled
	TaskCancelled TaskEventType = "Cancelled"
)

Directories

Path Synopsis
Package mock_eventpublisher is a generated GoMock package.
Package mock_eventpublisher is a generated GoMock package.

Jump to

Keyboard shortcuts

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