uniqueid

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: BSD-3-Clause Imports: 6 Imported by: 41

Documentation

Overview

Package uniqueid defines functions that are likely to generate globally unique identifiers. We want to be able to generate many Ids quickly, so we make a time/space tradeoff. We reuse the same random data many times with a counter appended. Note: these Ids are NOT useful as a security mechanism as they will be predictable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Valid

func Valid(id Id) bool

Valid returns true if the given Id is valid.

Types

type Id

type Id [16]byte

An Id is a likely globally unique identifier.

func FromHexString

func FromHexString(s string) (Id, error)

func Random

func Random() (Id, error)

Random produces a new probably unique identifier using the RandomGenerator.

func (Id) String

func (id Id) String() string

func (Id) VDLIsZero

func (x Id) VDLIsZero() bool

func (*Id) VDLRead

func (x *Id) VDLRead(dec vdl.Decoder) error

func (Id) VDLReflect

func (Id) VDLReflect(struct {
	Name string `vdl:"v.io/v23/uniqueid.Id"`
})

func (Id) VDLWrite

func (x Id) VDLWrite(enc vdl.Encoder) error

type RandomGenerator

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

A RandomGenerator can generate random Ids. The zero value of RandomGenerator is ready to use.

func (*RandomGenerator) NewID

func (g *RandomGenerator) NewID() (Id, error)

NewId produces a new probably unique identifier.

Jump to

Keyboard shortcuts

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