queue

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package queue implements a boldDB backed queue for MDM Commands.

Index

Constants

View Source
const (
	DeviceCommandBucket = "mdm.DeviceCommands"

	CommandQueuedTopic = "mdm.CommandQueued"
)

Variables

This section is empty.

Functions

func MarshalDeviceCommand

func MarshalDeviceCommand(c *DeviceCommand) ([]byte, error)

func MarshalQueuedCommand

func MarshalQueuedCommand(cq *QueueCommandQueued) ([]byte, error)

func UnmarshalDeviceCommand

func UnmarshalDeviceCommand(data []byte, c *DeviceCommand) error

Types

type Command

type Command struct {
	UUID    string
	Payload []byte

	CreatedAt    time.Time
	LastSentAt   time.Time
	Acknowledged time.Time

	TimesSent int

	LastStatus     string
	FailureMessage []byte
}

type DeviceCommand

type DeviceCommand struct {
	DeviceUDID string
	Commands   []Command

	// These are going to scale great. We'll have to see.
	Completed []Command
	Failed    []Command
	NotNow    []Command
}

type QueueCommandQueued

type QueueCommandQueued struct {
	DeviceUDID  string
	CommandUUID string
}

func UnmarshalQueuedCommand

func UnmarshalQueuedCommand(data []byte) (*QueueCommandQueued, error)

type Store

type Store struct {
	*bolt.DB
}

func NewQueue

func NewQueue(db *bolt.DB, pubsub pubsub.PublishSubscriber) (*Store, error)

func (*Store) DeviceCommand

func (db *Store) DeviceCommand(udid string) (*DeviceCommand, error)

func (*Store) Next

func (db *Store) Next(ctx context.Context, resp mdm.Response) ([]byte, error)

func (*Store) Save

func (db *Store) Save(cmd *DeviceCommand) error

Directories

Path Synopsis
internal
commandqueuedproto
Package commandqueued is a generated protocol buffer package.
Package commandqueued is a generated protocol buffer package.
devicecommandproto
Package devicecommandproto is a generated protocol buffer package.
Package devicecommandproto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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