Documentation ¶
Index ¶
- Variables
- func AddJob(message WorkRequest)
- func SetQueueType(queue string)
- func SetupNSQ(host, port string)
- func StartBolt(boltDir string, boltPerms os.FileMode) error
- func StartDispatcher(nworkers int, ApiKey string)
- type APIToken
- type Devices
- type Payload
- type RefreshToken
- type Registration
- type Sensor
- type Topic
- type User
- type WorkRequest
- type Worker
Constants ¶
This section is empty.
Variables ¶
View Source
var WorkQueue = make(chan WorkRequest, 100)
A buffered channel that we can send work requests on.
View Source
var WorkerQueue chan chan WorkRequest
Functions ¶
func AddJob ¶
func AddJob(message WorkRequest)
func SetQueueType ¶
func SetQueueType(queue string)
func StartDispatcher ¶
Types ¶
type Payload ¶
type Payload struct { Device *string `json:"device"` Name *string `json:"name"` Data *json.RawMessage `json:"payload"` }
type RefreshToken ¶
type RefreshToken struct { NewToken string `json:"newtoken"` OldToken string `json:"oldtoken"` Topic }
RefreshToken ... Describes a struct to update a device token with a refreshed token
func (*RefreshToken) Refresh ¶
func (refreshToken *RefreshToken) Refresh() error
Refresh ... Logic to replace one token with another
type Registration ¶
Registration ... object to hold a registration request
func (*Registration) JoinTopic ¶
func (register *Registration) JoinTopic() error
JoinTopic ... Join a new endpoint device to an already created topic
func (*Registration) LeaveTopic ¶
func (register *Registration) LeaveTopic() error
LeaveTopic ... Remove a device token from a topic
func (*Registration) Register ¶
func (register *Registration) Register() error
Register ... Register a new endpoint device
type Sensor ¶
Sensor ... Describes a struct containing a sensor device and a topic with optional friendly name
type User ¶
type WorkRequest ¶
type WorkRequest struct { //Sensor `json:"sensor"` Token string `json:"token"` Data *json.RawMessage `json:"data"` }
func (*WorkRequest) PublishToFirebase ¶
func (work *WorkRequest) PublishToFirebase() error
func (*WorkRequest) PublishToNSQ ¶
func (work *WorkRequest) PublishToNSQ() error
type Worker ¶
type Worker struct { ID int Work chan WorkRequest WorkerQueue chan chan WorkRequest QuitChan chan bool }
func NewWorker ¶
func NewWorker(id int, workerQueue chan chan WorkRequest) Worker
NewWorker creates, and returns a new Worker object. Its only argument is a channel that the worker can add itself to whenever it is done its work.
Click to show internal directories.
Click to hide internal directories.