workgate

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package workgate provides atomic admission and idle maintenance reservations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gate

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

func New

func New() *Gate

func (*Gate) Enter

func (g *Gate) Enter(ctx context.Context) (func(), error)

Enter waits while reserved for maintenance. An operation is not accepted until it owns a ticket. Existing tickets always run to completion.

func (*Gate) PauseIfIdle

func (g *Gate) PauseIfIdle() bool

func (*Gate) ReserveIfIdle added in v0.5.0

func (g *Gate) ReserveIfIdle() bool

ReserveIfIdle acquires a new maintenance reservation without stealing an existing update reservation or bypassing disabled admission.

func (*Gate) Resume

func (g *Gate) Resume()

func (*Gate) SetDisabled

func (g *Gate) SetDisabled(disabled bool)

SetDisabled changes admission without cancelling already accepted work or disturbing an independent managed-update reservation.

func (*Gate) State

func (g *Gate) State() (active int, paused bool)

Jump to

Keyboard shortcuts

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