# README
go-utils - general purpose helper functions for golang
What is it?
This is a collection of library functions I used in multiple go projects. It didn't have a good home so, I collectively put it here.
What is available?
- Threadsafe fixed-size circular queue
- Random UUIDv4 generator
- mmap(2) reader to read and process very large files in chunks
- Channel backed, fixed-size buffer pool. Unlike sync.Pool, this has a fixed size (set at construction time) and never changes. As a result, when the pool runs out of memory, the caller is blocked until another go-routine frees a buffer.
- Interactive password prompter.
# Functions
Given a wordlist in 'words', generate unique abbreviations of it and return as a map[abbrev]word.
Askpass prompts user for an interactive password.
Humanize turns a given uint64 into human readable string with a unit suffix of k, M, T, etc.
Make UUID from a raw byte stream.
No description provided by the author
NewBufpool creates a new Bufpool.
Make a new Queue instance to hold (at least) 'n' slots.
NewQFrom makes a new queue with contents from the initial list.
Make a new SPSC-Q to hold at-least 'n' elements.
NewSPSCQFrom makes a new SPSC-Q with the contents from the initial list 'v'.
Make a new thread-safe queue instance to hold (at least) 'n' slots.
NewSyncQFrom makes a new queue with contents from the initial list.
Make a new random UUID.
Parse a string that has a size suffix (one of k, M, G, T, P, E).
Unmarshal a string.
# Constants
Default pool size.
# Structs
No description provided by the author
A fixed-size buffer-pool backed by a channel and hence, callers are blocked if there are no more buffers available.
Q[T] is a generic fixed-size queue.
SPSCQ[T] is a generic & bounded single-producer/single-consumer queue.
SyncQ[T] is a generic, thread-safe, fixed-size queue.
UUID abstraction.