queue

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 15 Imported by: 3

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 PublishCommandQueued added in v1.9.0

func PublishCommandQueued(pub pubsub.Publisher, udid, uuid string) 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 Option added in v1.5.0

type Option func(*Store)

func WithLogger added in v1.5.0

func WithLogger(logger log.Logger) Option

func WithoutHistory added in v1.7.1

func WithoutHistory() Option

type QueueCommandQueued

type QueueCommandQueued struct {
	DeviceUDID  string
	CommandUUID string
}

func UnmarshalQueuedCommand

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

type Store

type Store struct {
	*bolt.DB
	// contains filtered or unexported fields
}

func NewQueue

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

func (*Store) Clear added in v1.8.0

func (db *Store) Clear(ctx context.Context, event mdm.CheckinEvent) 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

Jump to

Keyboard shortcuts

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