Documentation ¶
Overview ¶
Package engine implements the NanoCMD workflow engine.
Index ¶
- Constants
- Variables
- func NewErrNoSuchWorkflow(name string) error
- type Engine
- func (e *Engine) EnqueueStep(ctx context.Context, n workflow.Namer, se *workflow.StepEnqueueing) error
- func (e *Engine) MDMCheckinEvent(ctx context.Context, id string, checkin interface{}, ...) error
- func (e *Engine) MDMCommandResponseEvent(ctx context.Context, id string, uuid string, raw []byte, ...) error
- func (e *Engine) MDMIdleEvent(ctx context.Context, id string, raw []byte, mdmContext *workflow.MDMContext, ...) error
- func (e *Engine) RegisterWorkflow(w workflow.Workflow) error
- func (e *Engine) StartWorkflow(ctx context.Context, name string, context []byte, ids []string, ...) (string, error)
- func (e *Engine) UnregisterWorkflow(name string) error
- func (e *Engine) Workflow(name string) workflow.Workflow
- func (e *Engine) WorkflowRegistered(name string) bool
- type Enqueuer
- type Option
- type PushEnqueuer
- type RawEnqueuer
- type Worker
- type WorkerOption
- type WorkflowFinder
Constants ¶
const DefaultDuration = time.Minute * 5
const DefaultRePushDuration = time.Hour * 24
const DefaultTimeout = time.Hour * 24 * 3
DefaultTimeout is the default workflow step timeout. A workflow's configured timeout will override this default and a step's enqueued timeout will override that.
Variables ¶
var ( ErrNoSuchWorkflow = errors.New("no such workflow") ErrNoIDs = errors.New("no IDs") )
Functions ¶
func NewErrNoSuchWorkflow ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine coordinates workflows with MDM servers.
func (*Engine) EnqueueStep ¶
func (e *Engine) EnqueueStep(ctx context.Context, n workflow.Namer, se *workflow.StepEnqueueing) error
EnqueueStep stores the step and enqueues the commands to the MDM server.
func (*Engine) MDMCheckinEvent ¶
func (e *Engine) MDMCheckinEvent(ctx context.Context, id string, checkin interface{}, mdmContext *workflow.MDMContext) error
MDMCheckinEvent receives MDM checkin messages.
func (*Engine) MDMCommandResponseEvent ¶
func (e *Engine) MDMCommandResponseEvent(ctx context.Context, id string, uuid string, raw []byte, mdmContext *workflow.MDMContext) error
MDMCommandResponseEvent receives MDM command responses.
func (*Engine) MDMIdleEvent ¶ added in v0.3.0
func (e *Engine) MDMIdleEvent(ctx context.Context, id string, raw []byte, mdmContext *workflow.MDMContext, eventAt time.Time) error
MDMIdleEvent is called when an MDM Report Results has an "Idle" status. MDMIdleEvent will dispatch workflow "Idle" events (for workflows that are configured for it) and will also start workflows for the "IdleNotStartedSince" event subscription type. Note: any other event subscription type starting workflows is not supported.
func (*Engine) RegisterWorkflow ¶
RegisterWorkflow associates w with the engine by name.
func (*Engine) StartWorkflow ¶
func (e *Engine) StartWorkflow(ctx context.Context, name string, context []byte, ids []string, ev *workflow.Event, mdmCtx *workflow.MDMContext) (string, error)
StartWorkflow starts a new workflow instance for workflow name.
func (*Engine) UnregisterWorkflow ¶
UnregisterWorkflow dissociates the named workflow from the engine by name.
func (*Engine) WorkflowRegistered ¶
WorkflowRegistered returns true if the workflow name is registered.
type Enqueuer ¶
type Enqueuer interface { RawEnqueuer SupportsMultiCommands() bool }
Enqueuer sends raw Plist commands to enrollment IDs and relays multi-command capability.
type Option ¶
type Option func(*Engine)
Options configure the engine.
func WithDefaultTimeout ¶
WithDefaultTimeout configures the engine for a default workflow step timeout.
func WithEventStorage ¶
func WithEventStorage(evStorage storage.ReadEventSubscriptionStorage) Option
WithEventStorage turns on the event dispatch and configures the storage.
type PushEnqueuer ¶
type PushEnqueuer interface { RawEnqueuer Push(ctx context.Context, ids []string) error }
PushEnqueuer sends raw commands and APNs pushes to enrollment IDs.
type RawEnqueuer ¶
RawEnqueuer sends raw Plist commands to enrollment IDs.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker polls storage backends for timed events on an interval. Examples include step timeouts, delayed steps (NotUntil), and re-pushes.
func NewWorker ¶
func NewWorker(wff WorkflowFinder, storage storage.WorkerStorage, enqueuer PushEnqueuer, opts ...WorkerOption) *Worker
type WorkerOption ¶
type WorkerOption func(w *Worker)
func WithWorkerDuration ¶
func WithWorkerDuration(d time.Duration) WorkerOption
WithWorkerDuration configures the polling interval for the worker.
func WithWorkerLogger ¶
func WithWorkerLogger(logger log.Logger) WorkerOption
func WithWorkerRePushDuration ¶
func WithWorkerRePushDuration(d time.Duration) WorkerOption
WithWorkerRePushDuration configures when enrollments should be sent APNs pushes. This is the duration an enrollment ID has not received a response for an MDM command.
type WorkflowFinder ¶
Directories ¶
Path | Synopsis |
---|---|
Package http contains HTTP handlers that work with the NanoCMD engine.
|
Package http contains HTTP handlers that work with the NanoCMD engine. |
Package storage defines types and primitives for workflow engine storage backends.
|
Package storage defines types and primitives for workflow engine storage backends. |
diskv
Package diskv implements an engine storage backend using the diskv key-value store.
|
Package diskv implements an engine storage backend using the diskv key-value store. |
inmem
Package inmem implements an engine storage backend using the a map-based key-value store.
|
Package inmem implements an engine storage backend using the a map-based key-value store. |
kv
Package kv implements a workflow engine storage backend using a key-value interface.
|
Package kv implements a workflow engine storage backend using a key-value interface. |