Documentation
¶
Overview ¶
Package wakewordtraining mounts the v0.37.5 REST endpoints that accept wake-word activation training-data uploads from device clients. The endpoints are gated behind `[server.training_data].accept_uploads` — when false the mount returns 503 with a clear "feature disabled" payload so the device-side uploader can back off gracefully.
All endpoints scope every read and write to the caller's Identity{UserID, OrgID} (see internal/server/middleware/auth.go). One tenant cannot see or delete another tenant's recordings even when the audio dir is shared across organisations.
See docs/wakeword-training-data.md for the data shape, privacy contract, and end-to-end flow.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the HTTP mount.
func New ¶
New validates the options and returns a ready-to-mount handler. When AcceptUploads is false the returned handler still mounts the routes; every request gets 503 so device-side uploaders can detect and back off.
func (*Handler) Mount ¶
Mount wires the handler onto mux.
POST /v1/wakeword/activations — multipart upload
GET /v1/wakeword/activations — list caller's activations
GET /v1/wakeword/activations/{id} — fetch one
GET /v1/wakeword/activations/{id}/audio — fetch WAV bytes
PATCH /v1/wakeword/activations/{id} — update label
DELETE /v1/wakeword/activations/{id} — delete
type Options ¶
type Options struct {
// Store satisfies the WakewordActivationStore extension. Nil
// makes the mount return 503 because there's no persistence
// layer available.
Store store.WakewordActivationStore
// AudioDir is the filesystem root under which uploaded WAV
// bytes are written. Files land at
// <AudioDir>/<owner_org>/<owner_user>/<activation_id>.wav.
// Must already exist + be writable.
AudioDir string
// MaxUploadBytes caps the size of a single uploaded audio
// part. Keeps a misbehaving client from filling the disk in
// one request. Default 10 MiB.
MaxUploadBytes int64
// PerUserQuotaBytes — when > 0, uploads from a user whose
// existing sum-of-audio-bytes exceeds this value are rejected
// with 413. Set via [server.training_data].per_user_quota_bytes.
PerUserQuotaBytes int64
// AcceptUploads gates the entire feature. When false, every
// endpoint returns 503. Mirrors the
// [server.training_data].accept_uploads config knob.
AcceptUploads bool
// Now overrides time.Now for tests.
Now func() time.Time
}
Options configures the handler.