progress

package
v0.0.0-...-7c1ce7f Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	PageID string
	Send   chan []byte
	Conn   *websocket.Conn
}

func (*Client) WritePump

func (c *Client) WritePump(ctx context.Context)

type Event

type Event struct {
	Type     string   `json:"type"`
	PageID   string   `json:"page_id"`
	Progress Snapshot `json:"progress"`
}

type Hub

type Hub struct {
	// contains filtered or unexported fields
}

func NewHub

func NewHub() *Hub

func (*Hub) Publish

func (h *Hub) Publish(pageID string, snap Snapshot)

func (*Hub) Register

func (h *Hub) Register(c *Client)

func (*Hub) Run

func (h *Hub) Run()

func (*Hub) Unregister

func (h *Hub) Unregister(c *Client)

type ItemError

type ItemError struct {
	Path  string `json:"path,omitempty"`
	Code  string `json:"code,omitempty"`
	Error string `json:"error"`
}

type Publisher

type Publisher interface {
	Publish(pageID string, snap Snapshot)
}

type Reporter

type Reporter interface {
	SetOperation(op string, location string, total int)
	Add(delta int)
	Set(progress int)
	Error(err ItemError)
	Fatal(err error)
	Done()
}

type Snapshot

type Snapshot struct {
	TaskID      string      `json:"task_id"`
	Operation   string      `json:"operation"`
	Location    string      `json:"location,omitempty"`
	Total       int         `json:"total"`
	Progress    int         `json:"progress"`
	ProgressPct float64     `json:"progress_pct"`
	Rate        float64     `json:"rate"`
	ETASeconds  float64     `json:"eta_seconds,omitempty"`
	Done        bool        `json:"done,omitempty"`
	Fatal       string      `json:"fatal,omitempty"`
	Errors      []ItemError `json:"errors,omitempty"`
	StartedAt   time.Time   `json:"started_at"`
	UpdatedAt   time.Time   `json:"updated_at"`
}

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

func NewTracker

func NewTracker(pageID, taskID string, pub Publisher) *Tracker

func (*Tracker) Add

func (t *Tracker) Add(delta int)

func (*Tracker) Done

func (t *Tracker) Done()

func (*Tracker) Error

func (t *Tracker) Error(err ItemError)

func (*Tracker) Fatal

func (t *Tracker) Fatal(err error)

func (*Tracker) Set

func (t *Tracker) Set(progress int)

func (*Tracker) SetOperation

func (t *Tracker) SetOperation(op string, location string, total int)

Jump to

Keyboard shortcuts

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