utils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomPin

func GenerateRandomPin() string

func GetRandomName

func GetRandomName() (string, error)

GetRandomName returns mnemonicoded random name

func HashName

func HashName(b []byte) string

func SelfCheck

func SelfCheck(limits SelfCheckLimit, log logger.AppLogger, unhealhtyStreak int)

SelfCheck will watch the applications metrics, and crash it if it is considered to be unhealthy. This is only for use outside of kubernetes/docker

func SortedMapKeys

func SortedMapKeys[T any](input map[string]T) []string

Types

type Batcher

type Batcher struct {
	Watcher *fsnotify.Watcher

	Events chan []fsnotify.Event // Events are returned on this channel
	// contains filtered or unexported fields
}

Batcher batches file watch events in a given interval.

func NewDirWatcher

func NewDirWatcher(path string) (*Batcher, error)

Watches a directory recursively Caller must call .Close

func (*Batcher) Close

func (b *Batcher) Close()

type SelfCheckLimit

type SelfCheckLimit struct {
	MemoryMB   uint64
	GoRoutines int
	Streaks    int
}

Jump to

Keyboard shortcuts

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