Documentation ¶
Index ¶
- Constants
- func FlagsOf(n uint32) int
- func IsValidAsPulseNumber(n int) bool
- func SortData(data []Data)
- type Data
- func (r Data) AsPulseData() Data
- func (r Data) AsRange() Range
- func (r Data) CreateNextEphemeralPulse() Data
- func (r Data) CreateNextExpected() Data
- func (r Data) CreateNextPulsarPulse(delta uint16, entropyGen EntropyFunc) Data
- func (r Data) CreateNextPulse(entropyGen EntropyFunc) Data
- func (r Data) EnsureEphemeralData()
- func (r Data) EnsurePulsarData()
- func (r Data) EnsurePulseData()
- func (r Data) GetNextPulseDelta() uint16
- func (r Data) GetNextPulseNumber() (Number, bool)
- func (r Data) GetPrevPulseDelta() uint16
- func (r Data) GetPrevPulseNumber() (Number, bool)
- func (r Data) GetPulseEntropy() longbits.Bits256
- func (r Data) GetPulseNumber() Number
- func (r Data) GetStartOfEpoch() Number
- func (r Data) GetTimestamp() int64
- func (r Data) HasValidEpoch() bool
- func (r Data) HasValidTimeEpoch() bool
- func (r Data) IsEmpty() bool
- func (r Data) IsEmptyCompatibleWith(epoch Epoch) bool
- func (r Data) IsExpectedPulse() bool
- func (r Data) IsFirstPulse() bool
- func (r Data) IsFromEphemeral() bool
- func (r Data) IsFromPulsar() bool
- func (r Data) IsValidEphemeralData() bool
- func (r Data) IsValidExpectedPulsarData() bool
- func (r Data) IsValidExpectedPulseData() bool
- func (r Data) IsValidNext(n Data) bool
- func (r Data) IsValidPrev(p Data) bool
- func (r Data) IsValidPulsarData() bool
- func (r Data) IsValidPulseData() bool
- func (r Data) NextPulseNumber() Number
- func (r Data) PrevPulseNumber() Number
- func (r Data) String() string
- type DataExt
- type DataHolder
- type DataReader
- type DataSorter
- type EntropyFunc
- type Epoch
- type FindNumberFunc
- type Number
- func (n Number) AsApproximateTime() (time.Time, error)
- func (n Number) AsEpoch() Epoch
- func (n Number) AsUint32() uint32
- func (n Number) Bytes() []byte
- func (n Number) EnsureTimePulse() Number
- func (n Number) IsAfter(pn Number) bool
- func (n Number) IsBefore(pn Number) bool
- func (n Number) IsBeforeOrEq(pn Number) bool
- func (n Number) IsEqOrAfter(pn Number) bool
- func (n Number) IsEqOrOut(pn Number, prevDelta, nextDelta uint16) bool
- func (n Number) IsPackagePrivate() bool
- func (n Number) IsSpecial() bool
- func (n Number) IsSpecialOrPrivate() bool
- func (n Number) IsSpecialOrTimePulse() bool
- func (n Number) IsTimePulse() bool
- func (n Number) IsUnknown() bool
- func (n Number) IsUnknownOrEqualTo(o Number) bool
- func (n Number) IsUnknownOrTimePulse() bool
- func (n Number) Next(delta uint16) Number
- func (n Number) Prev(delta uint16) Number
- func (n Number) String() string
- func (n Number) TryNext(delta uint16) (Number, bool)
- func (n Number) TryPrev(delta uint16) (Number, bool)
- func (n Number) WithFlags(flags int) uint32
- type OnePulseRange
- func (p OnePulseRange) EnumData(fn func(Data) bool) bool
- func (p OnePulseRange) EnumNonArticulatedData(fn func(Data) bool) bool
- func (p OnePulseRange) EnumNonArticulatedNumbers(fn FindNumberFunc) bool
- func (p OnePulseRange) EnumNumbers(fn FindNumberFunc) bool
- func (p OnePulseRange) Equal(o Range) bool
- func (p OnePulseRange) IsArticulated() bool
- func (p OnePulseRange) IsSingular() bool
- func (p OnePulseRange) IsValidNext(a Range) bool
- func (p OnePulseRange) IsValidPrev(a Range) bool
- func (p OnePulseRange) LeftBoundNumber() Number
- func (p OnePulseRange) LeftPrevDelta() uint16
- func (p OnePulseRange) RightBoundData() Data
- type Range
Constants ¶
const ( Unknown Number = 0 MinPackagePrivate = 1 MaxPackagePrivate = 255 Reserved0 Number = 256 LocalRelative Number = localRelative // 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 // PulseNumberSize declares the number of bytes in the pulse number NumberSize = 4 )
========================================================= NB! To ADD a special pulse - see special_pulse_numbers.go =========================================================
const UnixTimeOfMaxTimePulse = UnixTimeOfMinTimePulse - MinTimePulse + MaxTimePulse // 2053-01-08 19:24:46 +0000 UTC
const UnixTimeOfMinTimePulse = 1546300800 // 2019-01-01 00:00:00 +0000 UTC
Variables ¶
This section is empty.
Functions ¶
func IsValidAsPulseNumber ¶
Types ¶
type Data ¶
func NewExpectedPulsarData ¶
func NewFirstEphemeralData ¶
func NewFirstEphemeralData() Data
func NewPulsarData ¶
func (Data) AsPulseData ¶
func (Data) CreateNextEphemeralPulse ¶
func (Data) CreateNextExpected ¶
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 (Data) GetNextPulseNumber ¶
func (Data) GetPrevPulseDelta ¶
func (Data) GetPrevPulseNumber ¶
func (Data) GetPulseEntropy ¶
func (Data) GetPulseNumber ¶
func (Data) GetStartOfEpoch ¶
func (Data) GetTimestamp ¶
func (Data) HasValidEpoch ¶
func (Data) HasValidTimeEpoch ¶
func (Data) IsEmptyCompatibleWith ¶
func (Data) IsExpectedPulse ¶
func (Data) IsFirstPulse ¶
func (Data) IsFromEphemeral ¶
func (Data) IsFromPulsar ¶
func (Data) IsValidEphemeralData ¶
func (Data) IsValidExpectedPulsarData ¶
func (Data) IsValidExpectedPulseData ¶
func (Data) IsValidNext ¶
func (Data) IsValidPrev ¶
func (Data) IsValidPulsarData ¶
func (Data) IsValidPulseData ¶
func (Data) NextPulseNumber ¶
func (Data) PrevPulseNumber ¶
type DataHolder ¶
type DataHolder interface { GetPulseNumber() Number GetPulseData() Data GetPulseDataDigest() cryptkit.DigestHolder }
type DataReader ¶
type DataSorter ¶
type DataSorter struct {
Data []Data
}
func (DataSorter) Len ¶
func (d DataSorter) Len() int
func (DataSorter) Less ¶
func (d DataSorter) Less(i, j int) bool
func (DataSorter) Swap ¶
func (d DataSorter) Swap(i, j int)
type EntropyFunc ¶
type Epoch ¶
type Epoch uint32
NB! Non-time epoch is ONLY allowed to be [1..255], range of [256..65535] is FORBIDDEN
func (Epoch) IsArticulation ¶
func (Epoch) IsCompatible ¶
func (Epoch) IsEphemeral ¶
func (Epoch) IsTimeEpoch ¶
func (Epoch) IsValidEpoch ¶
type FindNumberFunc ¶
type Number ¶
type Number uint32
Number is a type for pulse numbers.
Special values: 0 Unknown 1 .. 255 Reserved for package internal usage 256 Reserved 257 .. 65535 Reserved for platform wide usage 65536 Local relative pulse number 65537 .. 1<<30 - 1 Regular time based pulse numbers
NB! Range 0..256 IS RESERVED for internal operations There MUST BE NO references with PN < 256 ever visible to contracts / users.
const ( // Jet is a special pulse number value that signifies jet ID. // TODO either JetPrefix or ShortJetId - both are viable for addressing // Local part (can be omitted) - then it is a reference to a specific record within the jet // or to a jet-local built-in contract (via Base part) Jet Number // BuiltinContract declares special pulse number that creates namespace for builtin contracts // Base part is type/contract identity, Local part (can be omitted) identifies a version BuiltinContract // Base part - see FullJetId, and it has an indication to represent a JetDrop reference. // Local part (can be omitted) - then it is a reference to a specific record within the jet JetGeneration // and JetDrop and JetContract // Node, it is identified by 224 bits of node's PK hash // Local part (can be omitted) - then it is a reference to a specific state of the node or // node-local built-in contracts Node // Reference to a part of lifeline's record that is reused within the same lifeline without copying. // Base part defines jet + position of a referenced content within the record // Local part is a record id within the relevant lifeline/jet RecordPayload // Identity of an external call - initially it is not bound to lifelines, hence the separate addressing. // Base part - same as of Node ref of the node accepted the call // Local part - pulse of seed, hash of request ExternalCall // Identity of an endpoint // Indicates when the endpoint is free-to-call, can be served by any node, or needs a special handling. EndpointAddress // Identity of data relevant to pulse, e.g. network state hash, network population, jet tree etc DataOfPulse )
Number is a type for pulse numbers.
Special values:
0 Unknown 1 .. 256 RESERVED. For package internal usage 257 .. 65279 Available for platform-wide usage
65280 .. 65535 RESERVED. For global maps and aliases 65536 Local relative pulse number 65537 .. 1<<30 - 1 Regular time based pulse numbers
NB! Range 0..256 IS RESERVED for internal operations There MUST BE NO references with PN < 256 ever visible to contracts / users.
func OfUnixTime ¶
func (Number) EnsureTimePulse ¶
func (Number) IsBeforeOrEq ¶
func (Number) IsEqOrAfter ¶
func (Number) IsPackagePrivate ¶
func (Number) IsSpecialOrPrivate ¶
func (Number) IsSpecialOrTimePulse ¶
func (Number) IsTimePulse ¶
func (Number) IsUnknownOrEqualTo ¶
func (Number) IsUnknownOrTimePulse ¶
type OnePulseRange ¶
type OnePulseRange struct {
// contains filtered or unexported fields
}
func NewOnePulseRange ¶
func NewOnePulseRange(data Data) OnePulseRange
func (OnePulseRange) EnumNonArticulatedData ¶
func (p OnePulseRange) EnumNonArticulatedData(fn func(Data) bool) bool
func (OnePulseRange) EnumNonArticulatedNumbers ¶
func (p OnePulseRange) EnumNonArticulatedNumbers(fn FindNumberFunc) bool
func (OnePulseRange) EnumNumbers ¶
func (p OnePulseRange) EnumNumbers(fn FindNumberFunc) bool
func (OnePulseRange) Equal ¶
func (p OnePulseRange) Equal(o Range) bool
func (OnePulseRange) IsArticulated ¶
func (p OnePulseRange) IsArticulated() bool
func (OnePulseRange) IsSingular ¶
func (p OnePulseRange) IsSingular() bool
func (OnePulseRange) IsValidNext ¶
func (p OnePulseRange) IsValidNext(a Range) bool
func (OnePulseRange) IsValidPrev ¶
func (p OnePulseRange) IsValidPrev(a Range) bool
func (OnePulseRange) LeftBoundNumber ¶
func (p OnePulseRange) LeftBoundNumber() Number
func (OnePulseRange) LeftPrevDelta ¶
func (p OnePulseRange) LeftPrevDelta() uint16
func (OnePulseRange) RightBoundData ¶
func (p OnePulseRange) RightBoundData() Data
type Range ¶
type Range interface { // LeftBoundNumber provides a left bound of the range. It may be an expected pulse. LeftBoundNumber() Number // LeftPrevDelta is PrevDelta associated with the left boundary (refers to a pulse _before_ the left boundary). LeftPrevDelta() uint16 // RightBoundData returns a right bound of the range. MUST be a valid or expected pulse data. RightBoundData() Data // IsArticulated indicates that this range requires articulated pulses to be properly chained. IsArticulated() bool // IsSingular indicates that this range is a singular and contains only one pulse. IsSingular() bool // EnumNumbers iterates from smaller to higher pulses, over both provided and articulated pulses within the range. EnumNumbers(fn FindNumberFunc) bool // EnumNonArticulatedNumbers iterates from smaller to higher pulses, only over the provided pulse data within the range. EnumNonArticulatedNumbers(fn FindNumberFunc) bool // EnumData iterates from smaller to higher pulses, over both provided and articulated pulse data within the range. EnumData(func(Data) bool) bool // EnumNonArticulatedData iterates from smaller to higher pulses, only over the provided pulse data within the range. EnumNonArticulatedData(func(Data) bool) bool // IsValidNext returns true then the given range is next immediate range IsValidNext(Range) bool // IsValidPrev returns true then the given range is prev immediate range IsValidPrev(Range) bool // Equal returns true when both ranges are equal Equal(Range) bool }
func NewLeftGapRange ¶
Creates a range that covers a gap between the last expected pulse and the last available one. Will panic when pulse are overlapping and can't be properly connected. Supports gaps with delta > 65535
func NewPulseRange ¶
Creates a range that consists of both connected and disconnected pulses. Sequence MUST be sorted, an expected pulse is allowed at [0] Will panic when pulse are overlapping and can't be properly connected. Supports gaps with delta > 65535
func NewSequenceRange ¶
Creates a range that consists of >0 properly connected pulses. Sequence MUST be sorted, all pulses must be connected, otherwise use NewPulseRange() Will panic when pulse are overlapping and can't be properly connected. Supports gaps with delta > 65535