singleton

package
v1.19.32 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyRunning = errors.New("already running")
)

Functions

This section is empty.

Types

type Instance

type Instance interface {
	Run(ctx context.Context) error
}

func New

func New(fn func(ctx context.Context) error) Instance

type Singleton

type Singleton struct {
	Fn      func(ctx context.Context) error
	Running atomic.Bool
}

func (*Singleton) Run

func (s *Singleton) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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