sequence

package
v0.0.0-...-5c6c1e7 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemorySequencer

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

just for testing

func NewMemorySequencer

func NewMemorySequencer() (m *MemorySequencer)

func (*MemorySequencer) NextFileId

func (m *MemorySequencer) NextFileId(count uint64) uint64

func (*MemorySequencer) Peek

func (m *MemorySequencer) Peek() uint64

func (*MemorySequencer) SetMax

func (m *MemorySequencer) SetMax(seenValue uint64)

type Sequencer

type Sequencer interface {
	NextFileId(count uint64) uint64
	SetMax(uint64)
	Peek() uint64
}

type SnowflakeSequencer

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

a simple snowflake Sequencer

func NewSnowflakeSequencer

func NewSnowflakeSequencer(nodeid string, snowflakeId int) (*SnowflakeSequencer, error)

func (*SnowflakeSequencer) NextFileId

func (m *SnowflakeSequencer) NextFileId(count uint64) uint64

func (*SnowflakeSequencer) Peek

func (m *SnowflakeSequencer) Peek() uint64

return a new id as no Peek is stored

func (*SnowflakeSequencer) SetMax

func (m *SnowflakeSequencer) SetMax(seenValue uint64)

ignore setmax as we are snowflake

Jump to

Keyboard shortcuts

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