utils

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: May 26, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTerminateSignals default signals to handle
	// if not signals are provided
	// NOTE: we use the default st here instead of ALL signals
	// to avoid dying on signals like SIGCHLD and others that
	// are not intend to terminate the process
	DefaultTerminateSignals = []os.Signal{
		syscall.SIGTERM, syscall.SIGHUP, syscall.SIGINT,
		syscall.SIGQUIT,
	}
)

Functions

func NewRedisConn

func NewRedisConn(address string) (redis.Conn, error)

func NewRedisPool

func NewRedisPool(address string, size ...uint32) (*redis.Pool, error)

func OnDone

func OnDone(ctx context.Context, cb func(error))

OnDone registers a callback on a context when it's done The ctx.Err() is passed as is to the callback function

func WithSignal

func WithSignal(ctx context.Context, sig ...os.Signal) (context.Context, context.CancelFunc)

WithSignal return a context that is canceld if any of the specified signals was received

Types

type Mark

type Mark interface {
	Done(ctx context.Context) error
	Signal()
}

Mark defined a placeholder where multiple routines can use to synchronize their operation. Routines calling Done will be blocked until one calls Signal. After that all calls to Done should return immediately

func NewMark

func NewMark() Mark

type RedisDialParams

type RedisDialParams struct {
	Scheme  string
	Host    string
	Options []redis.DialOption
}

Jump to

Keyboard shortcuts

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