tools

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ShutdownContext context.Context
)

Functions

func AppendError

func AppendError(err, e error) error

func Cache

func Cache[K comparable, V any](f func(in K) V) func(in K) V

func Done

func Done()

func NewDebugServer

func NewDebugServer(addr string)

NewDebugServer .

func RunCommand

func RunCommand(ctx context.Context, name string, args []string, stdin io.Reader, stdout, stderr io.Writer) (<-chan error, error)

func ThreadUnsafeCache added in v0.1.14

func ThreadUnsafeCache[K comparable, V any](f func(in K) V) func(in K) V

func UnpaddingInt8s

func UnpaddingInt8s(buf []int8) string

func Wait

func Wait()

func WithoutTimeout

func WithoutTimeout(ctx context.Context) context.Context

WithoutCancel returns a context that is never canceled.

func Working

func Working()

func Wrap

func Wrap(ctx context.Context, f func())

func WrapWithLogger

func WrapWithLogger(ctx context.Context, logger *logrus.Logger, f func())

Types

type CacheOnce added in v0.1.14

type CacheOnce[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewCacheOnce added in v0.1.14

func NewCacheOnce[K comparable, V any](getter func(context.Context, K) (V, error)) *CacheOnce[K, V]

func (*CacheOnce[K, V]) Get added in v0.1.14

func (c *CacheOnce[K, V]) Get(ctx context.Context, req K) (V, error)

func (*CacheOnce[K, V]) Remove added in v0.1.14

func (c *CacheOnce[K, V]) Remove(req K)

type FileSystem

type FileSystem struct {
	TypeName      string
	MountPoint    string
	TotalSize     int64
	AvailableSize int64
}

func GetFileSystem

func GetFileSystem(path string) (*FileSystem, error)

type Pool added in v0.1.12

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

func NewPool added in v0.1.12

func NewPool[T any](f func() T) *Pool[T]

func (*Pool[T]) Get added in v0.1.12

func (p *Pool[T]) Get() T

func (*Pool[T]) Put added in v0.1.12

func (p *Pool[T]) Put(value T)

Jump to

Keyboard shortcuts

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