dmhook

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package dmhook defines service-operation metadata and the hook interface for observing or vetoing operations.

Design

Call and Hook let protocol packages supply behavior without importing server/service. Account-driven authentication checks and declarative lifecycle cleanup use this interface. server/service exposes aliases, so implementations written against either package satisfy the same contract. Hook ordering and error handling are defined by the service that invokes them.

References

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call struct {
	// Op is "checkin:<MessageType>", "connect", "enqueue", "export", or
	// "import".
	Op       string
	Request  *mdm.Request
	Checkin  *mdm.Checkin
	Response *mdm.Response
	Command  *mdm.Command
}

Call describes one service operation for hooks.

type Completer added in v0.2.0

type Completer interface {
	Complete(context.Context, *Call) error
}

Completer persists a successful check-in's authorization state before the transport reports success. An error is returned to the device; implementations must permit an idempotent retry after a partially completed service operation.

type Hook

type Hook interface {
	Before(ctx context.Context, c *Call) (context.Context, error)
	After(ctx context.Context, c *Call, err error)
}

Hook observes and may veto operations. Before runs before storage is touched; an error aborts the operation with CodeForbidden. After runs with the operation's result.

Jump to

Keyboard shortcuts

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