pulse

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown       Number = 0
	LocalRelative        = 65536
	// MinTimePulse is the hardcoded first pulse number. Because first 65536 numbers are saved for the system's needs
	MinTimePulse = LocalRelative + 1
	MaxTimePulse = 1<<30 - 1
	// Jet is a special pulse number value that signifies jet ID.
	Jet Number = 1
	// BuiltinContract declares special pulse number that creates namespace for builtin contracts
	BuiltinContract Number = 200
	// PulseNumberSize declares the number of bytes in the pulse number
	NumberSize int = 4
)
View Source
const EphemeralPulseEpoch = InvalidPulseEpoch + 1
View Source
const InvalidPulseEpoch uint32 = 0
View Source
const UnixTimeOfMaxTimePulse = UnixTimeOfMinTimePulse - MinTimePulse + MaxTimePulse // 2053-01-08 19:24:46 +0000 UTC
View Source
const UnixTimeOfMinTimePulse = 1546300800 // 2019-01-01 00:00:00 +0000 UTC

Variables

This section is empty.

Functions

func FlagsOf

func FlagsOf(n uint32) uint

func IsValidAsPulseNumber

func IsValidAsPulseNumber(n int) bool

Types

type Data

type Data struct {
	PulseNumber Number
	DataExt
}

func NewFirstEphemeralData

func NewFirstEphemeralData() Data

func NewFirstPulsarData

func NewFirstPulsarData(delta uint16, entropy longbits.Bits256) Data

func NewPulsarData

func NewPulsarData(pn Number, deltaNext uint16, deltaPrev uint16, entropy longbits.Bits256) Data

func (Data) CreateNextEphemeralPulse

func (r Data) CreateNextEphemeralPulse() Data

func (Data) CreateNextExpected

func (r Data) CreateNextExpected() Data

func (Data) CreateNextPulsarPulse

func (r Data) CreateNextPulsarPulse(delta uint16, entropyGen EntropyFunc) Data

func (Data) CreateNextPulse

func (r Data) CreateNextPulse(entropyGen EntropyFunc) Data

func (Data) EnsureEphemeralData

func (r Data) EnsureEphemeralData()

func (Data) EnsurePulsarData

func (r Data) EnsurePulsarData()

func (Data) EnsurePulseData

func (r Data) EnsurePulseData()

func (Data) GetNextPulseDelta

func (r Data) GetNextPulseDelta() uint16

func (Data) GetNextPulseNumber

func (r Data) GetNextPulseNumber() Number

func (Data) GetPrevPulseDelta

func (r Data) GetPrevPulseDelta() uint16

func (Data) GetPrevPulseNumber

func (r Data) GetPrevPulseNumber() Number

func (Data) GetPulseNumber

func (r Data) GetPulseNumber() Number

func (Data) GetStartOfEpoch

func (r Data) GetStartOfEpoch() Number

func (Data) GetTimestamp

func (r Data) GetTimestamp() uint64

func (Data) IsEmpty

func (r Data) IsEmpty() bool

func (Data) IsEmptyWithEpoch

func (r Data) IsEmptyWithEpoch(epoch uint32) bool

func (Data) IsExpectedPulse

func (r Data) IsExpectedPulse() bool

func (Data) IsFirstPulse

func (r Data) IsFirstPulse() bool

func (Data) IsFromEphemeral

func (r Data) IsFromEphemeral() bool

func (Data) IsFromPulsar

func (r Data) IsFromPulsar() bool

func (Data) IsValidEphemeralData

func (r Data) IsValidEphemeralData() bool

func (Data) IsValidExpectedPulseData

func (r Data) IsValidExpectedPulseData() bool

func (Data) IsValidNext

func (r Data) IsValidNext(n Data) bool

func (Data) IsValidPrev

func (r Data) IsValidPrev(p Data) bool

func (Data) IsValidPulsarData

func (r Data) IsValidPulsarData() bool

func (Data) IsValidPulseData

func (r Data) IsValidPulseData() bool

func (Data) String

func (r Data) String() string

type DataExt

type DataExt struct {
	// ByteSize=44
	PulseEpoch     uint32
	PulseEntropy   longbits.Bits256
	NextPulseDelta uint16
	PrevPulseDelta uint16
	Timestamp      uint32
}

type DataHolder

type DataHolder interface {
	GetPulseNumber() Number
	GetPulseData() Data
	GetPulseDataDigest() cryptkit.DigestHolder
}

type DataReader

type DataReader interface {
	GetPulseNumber() Number
	GetStartOfEpoch() Number
	// GetPulseEntropy()	[4]uint64
	GetNextPulseDelta() uint16
	GetPrevPulseDelta() uint16
	GetTimestamp() uint64
	IsExpectedPulse() bool
	IsFromEphemeral() bool
}

type EntropyFunc

type EntropyFunc func() longbits.Bits256

type Number

type Number uint32

func OfInt

func OfInt(n int) Number

func OfNow

func OfNow() Number

func OfTime

func OfTime(t time.Time) Number

func OfUint32

func OfUint32(n uint32) Number

func OfUnixTime

func OfUnixTime(u int64) Number

func (Number) AsApproximateTime

func (n Number) AsApproximateTime() (time.Time, error)

func (Number) AsUint32

func (n Number) AsUint32() uint32

func (Number) Bytes

func (n Number) Bytes() []byte

Bytes serializes pulse number.

func (Number) Equal

func (n Number) Equal(other Number) bool

func (Number) IsJet

func (n Number) IsJet() bool

func (Number) IsSpecial

func (n Number) IsSpecial() bool

func (Number) IsSpecialOrTimePulse

func (n Number) IsSpecialOrTimePulse() bool

func (Number) IsTimePulse

func (n Number) IsTimePulse() bool

func (Number) IsUnknown

func (n Number) IsUnknown() bool

func (Number) IsUnknownOrEqualTo

func (n Number) IsUnknownOrEqualTo(o Number) bool

func (Number) IsUnknownOrTimePulse

func (n Number) IsUnknownOrTimePulse() bool

func (Number) MarshalTo

func (n Number) MarshalTo(data []byte) (int, error)

func (Number) Next

func (n Number) Next(delta uint16) Number

func (Number) Prev

func (n Number) Prev(delta uint16) Number

func (Number) Size

func (n Number) Size() int

func (Number) String

func (n Number) String() string

func (*Number) Unmarshal

func (n *Number) Unmarshal(data []byte) error

func (Number) WithFlags

func (n Number) WithFlags(flags uint8) uint32

Jump to

Keyboard shortcuts

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