slot

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(s1, s2 *Slot) bool

Equal reports whether s1 has the same index as s2 or not.

func Init

func Init(blockIntervalSec int64)

Init initilizes various slot parameters

func IsNextTo

func IsNextTo(s1, s2 *Slot) bool

IsNextTo reports whether s1 corrensponds to the slot next to s2.

func LessEqual

func LessEqual(s1, s2 *Slot) bool

LessEqual reports whehter s1.nextIndex is less than or equal to s2.nextIndex

Types

type Slot

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

Slot is a DPoS slot implmentation.

func NewFromUnixNano

func NewFromUnixNano(ns int64) *Slot

NewFromUnixNano returns a Slot corresponding to a UNIX time value (ns).

func Now

func Now() *Slot

Now returns a Slot corresponding to the current local time.

func Time

func Time(t time.Time) *Slot

Time returns a Slot corresponting to the given time.

func (*Slot) GetBpTimeout

func (s *Slot) GetBpTimeout() int64

GetBpTimeout returns the time available for block production.

func (*Slot) IsFor

func (s *Slot) IsFor(bpIdx bp.Index, bpCount uint16) bool

IsFor reports whether s correponds to myBpIdx (block producer index).

func (*Slot) IsFuture added in v0.9.0

func (s *Slot) IsFuture() bool

IsFuture reports whether s

func (*Slot) IsValidNow

func (s *Slot) IsValidNow() bool

IsValidNow reports whether s is still valid at the time when it's called.

func (*Slot) NextBpIndex added in v0.8.1

func (s *Slot) NextBpIndex(bpCount uint16) int64

NextBpIndex returns BP index for s.nextIndex.

func (*Slot) RemainingTimeMS

func (s *Slot) RemainingTimeMS() int64

RemainingTimeMS returns the remaining duration until the next block generation time.

func (Slot) TimesUp

func (s Slot) TimesUp() bool

TimesUp reports whether the reminaing time <= BpMinTimeLimitMs

func (*Slot) UnixNano

func (s *Slot) UnixNano() int64

UnixNano returns UNIX time in ns.

Jump to

Keyboard shortcuts

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