adminmonitor

package
v0.0.0-...-270f78c Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Zlib Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const RedirectReasonAdminInitTimeout string = "AdminInitTimeout"

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

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

func New

func New(timeout time.Duration, datastore dataservices.DataStore, shutdownCtx context.Context) *Monitor

New creates a monitor that when started will wait for the timeout duration and then shutdown the application unless it has been initialized.

func (*Monitor) Start

func (m *Monitor) Start()

Starts starts the monitor. Active monitor could be stopped or shuttted down by cancelling the shutdown context.

func (*Monitor) Stop

func (m *Monitor) Stop()

Stop stops monitor. Safe to call even if monitor wasn't started.

func (*Monitor) WasInitialized

func (m *Monitor) WasInitialized() (bool, error)

WasInitialized is a system initialization check

func (*Monitor) WasInstanceDisabled

func (m *Monitor) WasInstanceDisabled() bool

func (*Monitor) WithRedirect

func (m *Monitor) WithRedirect(next http.Handler) http.Handler

WithRedirect checks whether administrator initialisation timeout. If so, it will return the error with redirect reason. Otherwise, it will pass through the request to next

Jump to

Keyboard shortcuts

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