seedmanager

package
v0.9.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 5 Imported by: 6

Documentation

Index

Constants

View Source
const DefaultCleanPeriod = 5 * time.Second

DefaultCleanPeriod default time period for launching cleaning goroutine

View Source
const DefaultTTL = 5 * time.Second

DefaultTTL is default time period for deleting expired seeds

View Source
const SeedSize uint = 32

SeedSize is size of seed

Variables

This section is empty.

Functions

This section is empty.

Types

type Expiration

type Expiration = int64

Expiration represents time of expiration

type Seed

type Seed = [SeedSize]byte

Seed is a type of seed

func SeedFromBytes added in v0.6.1

func SeedFromBytes(slice []byte) *Seed

SeedFromBytes converts slice of bytes to Seed. Returns nil if slice's size is not equal to SeedSize

type SeedGenerator

type SeedGenerator struct {
}

SeedGenerator holds logic with seed generation

func (*SeedGenerator) Next

func (sg *SeedGenerator) Next() (*Seed, error)

Next returns next random seed

type SeedManager

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

SeedManager manages working with seed pool It's thread safe

func New

func New() *SeedManager

New creates new seed manager with default params

func NewSpecified added in v0.6.1

func NewSpecified(ttl time.Duration, cleanPeriod time.Duration) *SeedManager

NewSpecified creates new seed manager with custom params

func (*SeedManager) Add

func (sm *SeedManager) Add(seed Seed, pulse insolar.PulseNumber)

Add adds seed to pool

func (*SeedManager) Pop added in v0.9.0

func (sm *SeedManager) Pop(seed Seed) (insolar.PulseNumber, bool)

Exists checks whether seed in the pool

func (*SeedManager) Stop added in v0.9.0

func (sm *SeedManager) Stop()

Jump to

Keyboard shortcuts

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