ig

package module
v0.0.0-...-03c3b93 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

README

ig

Identity Generator

Documentation

Index

Constants

View Source
const (
	NOTHING                    uint64 = 0 //"无中生有"
	BUCKET_OF_CARRAGE          string = "carrage"
	DEFAULT_PREGEN_FOR_NOTHING uint64 = 1
)
View Source
const (
	GT_NORMAL = iota
	GT_TIMED
	GT_LOOP
)

Variables

View Source
var (
	CCaMwR = errors.New("can't cook a meal without rice")
	ErrNCE = errors.New("NOTHING carrage exists")
	ErrCG  = errors.New("carrage gone")
)

Functions

func SetDefaultPregen

func SetDefaultPregen(pregen uint64)

Types

type Carrage

type Carrage struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Carrage) Fork

func (crg *Carrage) Fork() (*CarrageConfig, error)

func (*Carrage) Generate

func (crg *Carrage) Generate() (uint64, error)

func (*Carrage) GenerateByTimeNowUnix

func (crg *Carrage) GenerateByTimeNowUnix(tnu uint64) (uint64, error)

func (*Carrage) Merge

func (crg *Carrage) Merge(cfg *CarrageConfig) error

type CarrageConfig

type CarrageConfig struct {
	Name    string
	Profile string
	Tr      uint
	Pregen  uint64
	Incrs   []*IncrConfig
}

type Carrages

type Carrages struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCarrages

func NewCarrages(dsn string) (*Carrages, error)

func (*Carrages) DropCarrage

func (cgs *Carrages) DropCarrage(serl uint64) (*CarrageConfig, error)

func (*Carrages) Fork

func (cgs *Carrages) Fork(serl uint64) (*CarrageConfig, error)

func (*Carrages) Generate

func (cgs *Carrages) Generate(serl uint64) (uint64, error)

func (*Carrages) GenerateByTimeNowUnix

func (cgs *Carrages) GenerateByTimeNowUnix(serl uint64, tnu uint64) (uint64, error)

func (*Carrages) GetCarrageStatus

func (cgs *Carrages) GetCarrageStatus(serl uint64) (*CarrageConfig, error)

func (*Carrages) GetSerialNumbers

func (cgs *Carrages) GetSerialNumbers() []uint64

func (*Carrages) IsMaster

func (cgs *Carrages) IsMaster() bool

func (*Carrages) Merge

func (cgs *Carrages) Merge(serl uint64, cfg *CarrageConfig) error

func (*Carrages) NewCarrage

func (cgs *Carrages) NewCarrage(incr *util.Incrementer, name, profile string, tr uint, pg uint64) (uint64, error)

func (*Carrages) ReverseCarrage

func (cgs *Carrages) ReverseCarrage(serl uint64, cfg *CarrageConfig) error

func (*Carrages) SetMaster

func (cgs *Carrages) SetMaster() error

func (*Carrages) Stop

func (cgs *Carrages) Stop()

func (*Carrages) Wait

func (cgs *Carrages) Wait()

type Identity

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

type IncrConfig

type IncrConfig struct {
	Divisor uint64
	Ceiling uint64
	Standby uint64
}

type IncrsSortByCeiling

type IncrsSortByCeiling []*util.Incrementer

func (IncrsSortByCeiling) Len

func (incrs IncrsSortByCeiling) Len() int

func (IncrsSortByCeiling) Less

func (incrs IncrsSortByCeiling) Less(i, j int) bool

func (IncrsSortByCeiling) Swap

func (incrs IncrsSortByCeiling) Swap(i, j int)

Directories

Path Synopsis
cmd
igd

Jump to

Keyboard shortcuts

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