s3-orchestrator

adminstream

import "github.com/afreidah/s3-orchestrator/internal/transport/admin/adminstream"

Index

Constants

Event kinds. Every streamed line carries exactly one Kind.

const (
    KindStart     = "start"      // first line: operation accepted and beginning
    KindProgress  = "progress"   // emitted as work advances (single-line update)
    KindStepStart = "step_start" // a named unit of work began (no newline yet)
    KindStepEnd   = "step_end"   // that unit finished (completes the line)
    KindResult    = "result"     // final line: terminal outcome
)

Result outcomes carried on a KindResult event.

const (
    OutcomeOK      = "ok"
    OutcomeSkipped = "skipped"
    OutcomeFailed  = "failed"
)

ContentType is the media type for a newline-delimited JSON admin event stream. The client sets it in the Accept header to opt into streaming; the server sets it on the response when it streams.

const ContentType = "application/x-ndjson"

type Event

Event is one line of an admin operation stream. Each line is a self-contained JSON object; consumers switch on Kind. Counters carry incremental progress; Fields carries operation-specific detail (a final summary, per-backend rows) without growing the schema per operation.

type Event struct {
    Kind       string         `json:"event"`
    Op         string         `json:"op,omitempty"`          // start: operation name
    Message    string         `json:"message,omitempty"`     // progress label or skip reason
    Processed  int            `json:"processed,omitempty"`   // cumulative items handled
    Outcome    string         `json:"outcome,omitempty"`     // result: ok|skipped|failed
    Error      string         `json:"error,omitempty"`       // result: failure detail
    DurationMs int64          `json:"duration_ms,omitempty"` // result: wall-clock elapsed
    Fields     map[string]any `json:"fields,omitempty"`      // operation-specific detail
}

Generated by gomarkdoc