u

package module
v0.0.0-...-ea06120 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 4 Imported by: 0

README

Utility library for golang

The utility library provides basic ingredients to create a standalone program that is configured via YAML and which interacts sensibly with its environment.

  • dynamically update with configuration changes
  • take appropriate action on signal
  • log output sensibly

uboot

This package can be used to bootstrap your program. Here is a sample main.go:

//
// register lifecycle managers
//
func init() {
    golum.AddManager("thing", thing.TheMgr)
    golum.AddManager("foobar", foobar.TheMgr)
    ...
}

func main() {

    boot, err := uboot.SimpleBoot()
    if err != nil {
        ulog.Fatalf("Exitting due to startup failure: %s", err)
    }

    // ....

    uexit.SimpleSignalHandling() // park here until time to die
}

In the YAML config, if 'reload' is set to true, uboot will detect configuration changes and make them available to golum.

golum

This package is used to create components configured via uconfig. If the YAML contains a 'components' array, then each configuration will connote to a component to manage. Here is an example:

autoreload: true # uboot will detect config changes
debug: false # turn off debugging

components:
- name: thingOne
  type: thingFactory
  config: { ... }
- name: thingTwo
  type: thingFactory
  config: { ... }

uconfig

This package is used to read and validate configuration settings. It has a fluent api as well as a standard api.

Each component loaded by golum will get a uconfig.Section that is used by the registered factory to produce the component.

uerr

A simple error chaining package.

uexec

For shelling out to run commands.

uexit

For managing program exit and signals.

uinit

Some initialization functions.

uio

Some handy doodads for i/o.

ulog

For logging output. Has finer grained severity, and auto log file management.

uregistry

For registering things that need to be found in the program.

urest

For interacting with RESTful services.

ustrings

Some handy string and string slice thingees.

usync

Some handy synchronization doodads, such as semaphores.

build & test

    go get gopkg.in/yaml.v2
    go build
    go test ./...
    go vet ./...
    go test -run=^Z -benchtime=3s -benchmem -bench=. ./usync
    go test -run=^Z -benchtime=3s -benchmem -bench=. ./uthrottle

Documentation

Overview

Utility library for golang

The utility library provides basic ingredients to create a standalone program that is configured via YAML and which interacts sensibly with its environment. * dynamically update with configuration changes * take appropriate action on signal * log output sensibly

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IdBuilder

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

a simple, fast 64 bit unique ID generator

func NewIdBuilder

func NewIdBuilder() (rv IdBuilder)

create an IdBuilder

func (*IdBuilder) NewId

func (this *IdBuilder) NewId() (rv string)

creates a 24 rune string id using base62 character set

top 11 runes are date/time

bottom 13 runes are counter with random base

Directories

Path Synopsis
Package golum is used to load components into the process based on YAML configuration from uconfig.
Package golum is used to load components into the process based on YAML configuration from uconfig.
Package uboot manages process startup, setting up logging, signal handling, and loading of components through golum and uconfig.
Package uboot manages process startup, setting up logging, signal handling, and loading of components through golum and uconfig.
Package uconfig enables access to the configuration loaded by uboot / golum.
Package uconfig enables access to the configuration loaded by uboot / golum.
Package uerr enables chaining errors and has some error related utilities.
Package uerr enables chaining errors and has some error related utilities.
Package ulog provides a richer wrapper for the std log library.
Package ulog provides a richer wrapper for the std log library.
Package uregistry is a simple lookup service that allows objects to be registered and later looked up.
Package uregistry is a simple lookup service that allows objects to be registered and later looked up.
Package sftp implements the SSH File Transfer Protocol as described in https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
Package sftp implements the SSH File Transfer Protocol as described in https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
throttles for limiting work done per interval
throttles for limiting work done per interval

Jump to

Keyboard shortcuts

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