Documentation ¶
Overview ¶
ID implements a 128-bit pastry ID. 128-bit is larger than most applications will need, so utility functions exist to convert into smaller representations.
IDs are converted into a power-of-two base, up to hexadecimal, for message routing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Lowest and highest values
Functions ¶
Types ¶
type Digits ¶
type Digits []byte
Digits is a set of individual digits of an ID after converting it into a different base.
type Generator ¶
Generator generates IDs based on an input string.
func NewGenerator ¶
NewGenerator returns an ID generator where IDs will be generated from a hash of size (must be one of 8, 16, 32, 64, 128).
type ID ¶
type ID struct {
High, Low uint64
}
ID is an unsigned 128-bit number used to identify nodes and assign ownership to resources.
func MaxForSize ¶
MaxForSize returns the max ID for the given size in bits. size must be multiple of 2 and between 8 and 128 inclusive.