rand

package
v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTokenGenerator

func NewTokenGenerator(n int) platform.TokenGenerator

NewTokenGenerator creates an instance of an platform.TokenGenerator.

Types

type OrgBucketID

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

OrgBucketID creates an id that does not have ascii backslash, commas, or spaces. Used to create IDs for organizations and buckets.

It is implemented without those characters because orgbucket pairs are placed in the old measurement field. Measurement was interpreted as a string delimited with commas. Therefore, to continue to use the underlying storage engine we need to sanitize ids.

Safe for concurrent use by multiple goroutines.

func NewOrgBucketID

func NewOrgBucketID(seed int64) *OrgBucketID

NewOrgBucketID creates an influxdb.IDGenerator that creates random numbers seeded with seed. Ascii backslash, comma, and space are manipulated by incrementing.

Typically, seed with `time.Now().UnixNano()`

func (*OrgBucketID) ID

func (r *OrgBucketID) ID() influxdb.ID

ID generates an ID that does not have backslashes, commas, or spaces.

func (*OrgBucketID) Seed

func (r *OrgBucketID) Seed(seed int64)

Seed allows one to override the current seed. Typically, this override is done for tests.

type TokenGenerator

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

TokenGenerator implements platform.TokenGenerator.

func (*TokenGenerator) Token

func (t *TokenGenerator) Token() (string, error)

Token returns a new string token of size t.size.

Jump to

Keyboard shortcuts

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