safego

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaulSafegoLogger relec.Logger

Functions

func Close

func Close[T any](ch chan T)

func Insert

func Insert[T any](ch chan<- T, value T) bool

func Recovery

func Recovery(exit bool)

Types

type Execution

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

func Run

func Run(f func()) *Execution

Run runs a new goroutine and add panic handler (without restart)

func RunWithRestart

func RunWithRestart(f func()) *Execution

RunWithRestart run a new goroutine and add panic handler: write logs, wait 2 seconds and restart the goroutine

func (*Execution) WithRestartTimeout

func (exec *Execution) WithRestartTimeout(timeout time.Duration) *Execution

type Lake added in v0.0.3

type Lake[T any] struct {
	// contains filtered or unexported fields
}

func NewLake added in v0.0.3

func NewLake[T any](ctx context.Context, buffer int, exec func(one T) (exit bool, err error)) *Lake[T]

func (*Lake[T]) NewStream added in v0.0.3

func (l *Lake[T]) NewStream() *Stream[T]

func (*Lake[T]) Stats added in v0.0.3

func (l *Lake[T]) Stats() string

func (*Lake[T]) Wait added in v0.0.3

func (l *Lake[T]) Wait() error

type RecoverHandler

type RecoverHandler func(value interface{})
var GlobalRecoverHandler RecoverHandler = func(value interface{}) {}

type Stream added in v0.0.3

type Stream[T any] struct {
	// contains filtered or unexported fields
}

func (*Stream[T]) Close added in v0.0.9

func (ch *Stream[T]) Close()

func (*Stream[T]) Insert added in v0.0.3

func (ch *Stream[T]) Insert(value T)

Jump to

Keyboard shortcuts

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