offlinegate

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OfflineGate

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

OfflineGate is an entity that works similar to a mutex with signaling Only the caller that has Locked a gate can unlock it, otherwise it will be blocked with a call to Lock. Gate provides a passthrough http middleware that will wait for a locked gate to be unlocked. For safety reasons, the middleware will timeout

func NewOfflineGate

func NewOfflineGate() *OfflineGate

NewOfflineGate creates a new gate

func (*OfflineGate) Lock

func (o *OfflineGate) Lock() func()

Lock locks readonly gate and returns a function to unlock

func (*OfflineGate) WaitingMiddleware

func (o *OfflineGate) WaitingMiddleware(timeout time.Duration, next http.Handler) http.Handler

WaitingMiddleware returns an http handler that waits for the gate to be unlocked before continuing

Jump to

Keyboard shortcuts

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