s3-orchestrator

progress

import "github.com/afreidah/s3-orchestrator/internal/progress"

Index

Constants

Outcome values reported on a PhaseEnd step.

const (
    StatusOK     = "ok"
    StatusFailed = "failed"
)

func Track

func Track(o Observer, label string, fn func() string)

Track brackets one unit of work: it emits a start step, runs fn, then emits an end step with the status fn returns and the elapsed time. fn always runs, so a nil observer disables reporting without changing behavior.

type Observer

Observer receives a start and then an end step for each unit of work. A nil Observer means progress reporting is disabled.

type Observer func(Step)

type Phase

Phase marks the start or end of one unit of work.

type Phase int

const (
    PhaseStart Phase = iota // the unit began
    PhaseEnd                // the unit finished
)

type Step

Step is one progress notification for a single unit of work. Status and Duration are set on PhaseEnd only.

type Step struct {
    Label    string // the item being processed (object key, backend name)
    Phase    Phase
    Status   string
    Duration time.Duration
}

Generated by gomarkdoc