packets

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeNodeJoinClaim = ClaimType(iota + 1)
	TypeNodeAnnounceClaim
	TypeCapabilityPollingAndActivation
	TypeNodeViolationBlame
	TypeNodeBroadcast
	TypeNodeLeaveClaim
	TypeChangeNetworkClaim
)
View Source
const (
	Phase1 = PacketType(iota + 1)
	Phase2
	Phase3
)
View Source
const (
	TypeStateFraudNodeSupplementaryVote = VoteType(iota + 1)
	TypeNodeListSupplementaryVote
	TypeMissingNodeSupplementaryVote
	TypeMissingNode
	TypeMissingNodeClaim
)
View Source
const HashLength = 64
View Source
const HeaderSize = 2
View Source
const NodeAddressSize = 20
View Source
const PublicKeyLength = 66
View Source
const ReferenceLength = 64
View Source
const SignatureLength = 66

Variables

View Source
var (
	// ErrBitSetOutOfRange is returned when index passed to IndexToRef function is out of range (ERROR)
	ErrBitSetOutOfRange = errors.New("index out of range")
	// ErrBitSetNodeIsMissing is returned in IndexToRef when we have no information about the node on specified index (SPECIAL CASE)
	ErrBitSetNodeIsMissing = errors.New("no information about node on specified index")
	// ErrBitSetIncorrectNode is returned when an incorrect node is passed to RefToIndex (ERROR)
	ErrBitSetIncorrectNode = errors.New("incorrect node ID")
)

Possible errors in BitSetMapper

Functions

This section is empty.

Types

type BitSet

type BitSet interface {
	Serialize() ([]byte, error)
	// GetCells get buckets of bitset
	GetCells(mapper BitSetMapper) ([]BitSetCell, error)
	// GetTristateArray get underlying tristate
	GetTristateArray() ([]TriState, error)
	// ApplyChanges returns copy of the current bitset with changes applied
	ApplyChanges(changes []BitSetCell, mapper BitSetMapper) error
}

BitSet is interface

func DeserializeBitSet

func DeserializeBitSet(data io.Reader) (BitSet, error)

func NewBitSet

func NewBitSet(size int) (BitSet, error)

NewBitSet creates bitset from a set of buckets and the mapper. Size == cells count.

type BitSetCell

type BitSetCell struct {
	NodeID core.RecordRef
	State  TriState
}

BitSetCell is structure that contains the state of the node

type BitSetMapper

type BitSetMapper interface {
	// IndexToRef get ID of the node that is stored on the specified internal index
	IndexToRef(index int) (core.RecordRef, error)
	// RefToIndex get bitset internal index where the specified node state is stored
	RefToIndex(nodeID core.RecordRef) (int, error)
	// Length returns required length of the bitset
	Length() int
}

BitSetMapper contains the mapping from bitset index to node ID (and vice versa)

type CapabilityPoolingAndActivation

type CapabilityPoolingAndActivation struct {
	PollingFlags   uint16
	CapabilityType uint16
	CapabilityRef  [ReferenceLength]byte
}

CapabilityPoolingAndActivation is a type 3.

func (*CapabilityPoolingAndActivation) Clone added in v0.8.0

func (*CapabilityPoolingAndActivation) Deserialize

func (cpa *CapabilityPoolingAndActivation) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*CapabilityPoolingAndActivation) Serialize

func (cpa *CapabilityPoolingAndActivation) Serialize() ([]byte, error)

Serialize implements interface method

func (*CapabilityPoolingAndActivation) Type

type ChangeNetworkClaim

type ChangeNetworkClaim struct {
}

ChangeNetworkClaim uses to change network state.

func (*ChangeNetworkClaim) Type

func (cnc *ChangeNetworkClaim) Type() ClaimType

type ClaimSupplementary added in v0.8.0

type ClaimSupplementary interface {
	AddSupplementaryInfo(nodeID core.RecordRef)
}

type ClaimType

type ClaimType uint8

func (ClaimType) String added in v0.8.0

func (i ClaimType) String() string

type ConsensusPacket

type ConsensusPacket interface {
	GetType() PacketType
	Clone() ConsensusPacket

	SignedPacket
	HeaderSkipDeserializer
	Serializer
	PacketRoutable
}

func ExtractPacket

func ExtractPacket(reader io.Reader) (ConsensusPacket, error)

type GlobuleHashSignature added in v0.8.0

type GlobuleHashSignature [SignatureLength]byte

type HeaderSkipDeserializer

type HeaderSkipDeserializer interface {
	DeserializeWithoutHeader(data io.Reader, header *PacketHeader) error
}

type MissingNode

type MissingNode struct {
	NodeIndex uint16
}

func (*MissingNode) Deserialize

func (mn *MissingNode) Deserialize(data io.Reader) error

func (*MissingNode) Serialize

func (mn *MissingNode) Serialize() ([]byte, error)

func (*MissingNode) Type

func (mn *MissingNode) Type() VoteType

type MissingNodeClaim added in v0.8.0

type MissingNodeClaim struct {
	NodeIndex uint16

	Claim ReferendumClaim
	// contains filtered or unexported fields
}

func (*MissingNodeClaim) Deserialize added in v0.8.0

func (mn *MissingNodeClaim) Deserialize(data io.Reader) error

func (*MissingNodeClaim) Serialize added in v0.8.0

func (mn *MissingNodeClaim) Serialize() ([]byte, error)

func (*MissingNodeClaim) Type added in v0.8.0

func (mn *MissingNodeClaim) Type() VoteType

type MissingNodeSupplementaryVote

type MissingNodeSupplementaryVote struct {
	NodeIndex uint16

	NodePulseProof NodePulseProof
	// TODO: make it signed
	NodeClaimUnsigned NodeJoinClaim
}

func (*MissingNodeSupplementaryVote) Deserialize

func (v *MissingNodeSupplementaryVote) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*MissingNodeSupplementaryVote) Serialize

func (v *MissingNodeSupplementaryVote) Serialize() ([]byte, error)

Serialize implements interface method

func (*MissingNodeSupplementaryVote) Type

type NodeAddress added in v0.8.0

type NodeAddress [NodeAddressSize]byte

TODO: create heterogeneous structure for variuos types of adresses (IPv4, IPv6, etc.)

func NewNodeAddress added in v0.8.0

func NewNodeAddress(address string) NodeAddress

func (NodeAddress) Get added in v0.8.0

func (address NodeAddress) Get() string

func (*NodeAddress) Set added in v0.8.0

func (address *NodeAddress) Set(s string)

type NodeAnnounceClaim

type NodeAnnounceClaim struct {
	NodeJoinClaim

	NodeAnnouncerIndex uint16
	NodeJoinerIndex    uint16
	NodeCount          uint16
	CloudHash          [HashLength]byte

	// mapper is used to fill three fields above, is not serialized
	BitSetMapper BitSetMapper
}

NodeJoinClaim is a type 5, len == 272.

func (*NodeAnnounceClaim) Clone added in v0.8.0

func (nac *NodeAnnounceClaim) Clone() ReferendumClaim

func (*NodeAnnounceClaim) Deserialize added in v0.7.5

func (nac *NodeAnnounceClaim) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*NodeAnnounceClaim) Serialize added in v0.7.5

func (nac *NodeAnnounceClaim) Serialize() ([]byte, error)

Serialize implements interface method

func (*NodeAnnounceClaim) SerializeRaw added in v0.8.0

func (nac *NodeAnnounceClaim) SerializeRaw() ([]byte, error)

func (*NodeAnnounceClaim) SetCloudHash added in v0.8.0

func (nac *NodeAnnounceClaim) SetCloudHash(cloudHash []byte)

func (*NodeAnnounceClaim) Type

func (nac *NodeAnnounceClaim) Type() ClaimType

func (*NodeAnnounceClaim) Update added in v0.8.0

func (nac *NodeAnnounceClaim) Update(nodeJoinerID core.RecordRef, crypto core.CryptographyService) error

type NodeBroadcast

type NodeBroadcast struct {
	EmergencyLevel uint8
}

NodeBroadcast is a broadcast of info. Must be brief and only one entry per node. Type 4.

func (*NodeBroadcast) Clone added in v0.8.0

func (nb *NodeBroadcast) Clone() ReferendumClaim

func (*NodeBroadcast) Deserialize

func (nb *NodeBroadcast) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*NodeBroadcast) Serialize

func (nb *NodeBroadcast) Serialize() ([]byte, error)

Serialize implements interface method

func (*NodeBroadcast) Type

func (nb *NodeBroadcast) Type() ClaimType

type NodeJoinClaim

type NodeJoinClaim struct {
	ShortNodeID             core.ShortNodeID
	RelayNodeID             core.ShortNodeID
	ProtocolVersionAndFlags uint32
	JoinsAfter              uint32
	NodeRoleRecID           core.StaticRole
	NodeRef                 core.RecordRef
	NodeAddress             NodeAddress
	NodePK                  [PublicKeyLength]byte
	Signature               [SignatureLength]byte
}

NodeJoinClaim is a type 1, len == 272.

func NodeToClaim added in v0.8.0

func NodeToClaim(node core.Node) (*NodeJoinClaim, error)

func (*NodeJoinClaim) Clone added in v0.8.0

func (njc *NodeJoinClaim) Clone() ReferendumClaim

func (*NodeJoinClaim) Deserialize

func (njc *NodeJoinClaim) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*NodeJoinClaim) GetNodeID added in v0.8.0

func (njc *NodeJoinClaim) GetNodeID() core.RecordRef

func (*NodeJoinClaim) GetPublicKey added in v0.8.0

func (njc *NodeJoinClaim) GetPublicKey() (crypto.PublicKey, error)

func (*NodeJoinClaim) GetSignature added in v0.8.0

func (njc *NodeJoinClaim) GetSignature() []byte

func (*NodeJoinClaim) Serialize

func (njc *NodeJoinClaim) Serialize() ([]byte, error)

Serialize implements interface method

func (*NodeJoinClaim) SerializeRaw added in v0.8.0

func (njc *NodeJoinClaim) SerializeRaw() ([]byte, error)

func (*NodeJoinClaim) Type

func (njc *NodeJoinClaim) Type() ClaimType

type NodeLeaveClaim

type NodeLeaveClaim struct {
	// additional field that is not serialized and is set from transport layer on packet receive
	NodeID core.RecordRef
	ETA    core.PulseNumber
}

NodeLeaveClaim can be the only be issued by the node itself and must be the only claim record. Should be executed with the next pulse. Type 1, len == 0.

func (*NodeLeaveClaim) AddSupplementaryInfo added in v0.8.0

func (nlc *NodeLeaveClaim) AddSupplementaryInfo(nodeID core.RecordRef)

func (*NodeLeaveClaim) Clone added in v0.8.0

func (nlc *NodeLeaveClaim) Clone() ReferendumClaim

func (*NodeLeaveClaim) Deserialize

func (nlc *NodeLeaveClaim) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*NodeLeaveClaim) Serialize

func (nlc *NodeLeaveClaim) Serialize() ([]byte, error)

Serialize implements interface method

func (*NodeLeaveClaim) Type

func (nlc *NodeLeaveClaim) Type() ClaimType

type NodeListHash added in v0.8.0

type NodeListHash [32]byte

type NodeListSupplementaryVote

type NodeListSupplementaryVote struct {
	NodeListCount uint16
	NodeListHash  NodeListHash
}

func (*NodeListSupplementaryVote) Deserialize

func (v *NodeListSupplementaryVote) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*NodeListSupplementaryVote) Serialize

func (v *NodeListSupplementaryVote) Serialize() ([]byte, error)

Serialize implements interface method

func (*NodeListSupplementaryVote) Type

type NodePulseProof

type NodePulseProof struct {
	NodeStateHash [HashLength]byte
	NodeSignature [SignatureLength]byte
}

func (*NodePulseProof) Deserialize

func (npp *NodePulseProof) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*NodePulseProof) Serialize

func (npp *NodePulseProof) Serialize() ([]byte, error)

Serialize implements interface method

func (*NodePulseProof) Signature

func (npp *NodePulseProof) Signature() []byte

func (*NodePulseProof) StateHash

func (npp *NodePulseProof) StateHash() []byte

type NodeViolationBlame

type NodeViolationBlame struct {
	BlameNodeID   uint32
	TypeViolation uint8
}

NodeViolationBlame is a type 2.

func (*NodeViolationBlame) Clone added in v0.8.0

func (nvb *NodeViolationBlame) Clone() ReferendumClaim

func (*NodeViolationBlame) Deserialize

func (nvb *NodeViolationBlame) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*NodeViolationBlame) Serialize

func (nvb *NodeViolationBlame) Serialize() ([]byte, error)

Serialize implements interface method

func (*NodeViolationBlame) Type

func (nvb *NodeViolationBlame) Type() ClaimType

type PacketHeader

type PacketHeader struct {
	PacketT    PacketType
	HasRouting bool

	Pulse uint32
	//-----------------
	OriginNodeID core.ShortNodeID
	TargetNodeID core.ShortNodeID
	// contains filtered or unexported fields
}

func (*PacketHeader) Deserialize

func (ph *PacketHeader) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*PacketHeader) Serialize

func (ph *PacketHeader) Serialize() ([]byte, error)

Serialize implements interface method

type PacketRoutable

type PacketRoutable interface {
	GetOrigin() core.ShortNodeID
	GetTarget() core.ShortNodeID
	SetRouting(origin, target core.ShortNodeID)
}

type PacketType

type PacketType uint8

func (PacketType) String added in v0.8.0

func (i PacketType) String() string

type Phase1Packet

type Phase1Packet struct {

	// --------------------
	// signature contains signature of Header + Section 1 + Section 2
	Signature [SignatureLength]byte
	// contains filtered or unexported fields
}

func NewPhase1Packet

func NewPhase1Packet(pulse core.Pulse) *Phase1Packet

func (*Phase1Packet) AddClaim

func (p1p *Phase1Packet) AddClaim(claim ReferendumClaim) bool

AddClaim adds claim if phase1Packet has space for it and returns true, otherwise returns false

func (*Phase1Packet) Clone added in v0.8.0

func (p1p *Phase1Packet) Clone() ConsensusPacket

func (*Phase1Packet) Deserialize

func (p1p *Phase1Packet) Deserialize(data io.Reader) error

func (*Phase1Packet) DeserializeWithoutHeader

func (p1p *Phase1Packet) DeserializeWithoutHeader(data io.Reader, header *PacketHeader) error

func (*Phase1Packet) GetAnnounceClaim added in v0.8.0

func (p1p *Phase1Packet) GetAnnounceClaim() *NodeAnnounceClaim

func (*Phase1Packet) GetClaims

func (p1p *Phase1Packet) GetClaims() []ReferendumClaim

func (*Phase1Packet) GetOrigin added in v0.8.0

func (p1p *Phase1Packet) GetOrigin() core.ShortNodeID

func (*Phase1Packet) GetPulse

func (p1p *Phase1Packet) GetPulse() core.Pulse

func (*Phase1Packet) GetPulseNumber

func (p1p *Phase1Packet) GetPulseNumber() core.PulseNumber

func (*Phase1Packet) GetPulseProof

func (p1p *Phase1Packet) GetPulseProof() *NodePulseProof

func (*Phase1Packet) GetTarget added in v0.8.0

func (p1p *Phase1Packet) GetTarget() core.ShortNodeID

func (*Phase1Packet) GetType added in v0.8.0

func (p1p *Phase1Packet) GetType() PacketType

func (*Phase1Packet) RemoveAnnounceClaim added in v0.8.0

func (p1p *Phase1Packet) RemoveAnnounceClaim()

TODO: I AM AWFUL WORKAROUND, NEED TO REWORK

func (*Phase1Packet) Serialize

func (p1p *Phase1Packet) Serialize() ([]byte, error)

func (*Phase1Packet) SetPulseProof

func (p1p *Phase1Packet) SetPulseProof(proofStateHash, proofSignature []byte) error

SetPulseProof sets PulseProof and check struct fields len, returns error if invalid len

func (*Phase1Packet) SetRouting added in v0.8.0

func (p1p *Phase1Packet) SetRouting(origin, target core.ShortNodeID)

func (*Phase1Packet) Sign added in v0.8.0

func (p1p *Phase1Packet) Sign(cryptographyService core.CryptographyService) error

func (*Phase1Packet) Verify added in v0.8.0

func (p1p *Phase1Packet) Verify(crypto core.CryptographyService, key crypto.PublicKey) error

type Phase2Packet

type Phase2Packet struct {
	SignatureHeaderSection1 [SignatureLength]byte

	SignatureHeaderSection2 [SignatureLength]byte
	// contains filtered or unexported fields
}

func NewPhase2Packet added in v0.8.0

func NewPhase2Packet(number core.PulseNumber) *Phase2Packet

func (*Phase2Packet) AddVote added in v0.7.5

func (p2p *Phase2Packet) AddVote(vote ReferendumVote)

func (*Phase2Packet) Clone added in v0.8.0

func (p2p *Phase2Packet) Clone() ConsensusPacket

func (*Phase2Packet) ContainsRequests added in v0.7.5

func (p2p *Phase2Packet) ContainsRequests() bool

func (*Phase2Packet) ContainsResponses added in v0.8.0

func (p2p *Phase2Packet) ContainsResponses() bool

func (*Phase2Packet) Deserialize

func (p2p *Phase2Packet) Deserialize(data io.Reader) error

func (*Phase2Packet) DeserializeWithoutHeader

func (p2p *Phase2Packet) DeserializeWithoutHeader(data io.Reader, header *PacketHeader) error

func (*Phase2Packet) GetBitSet

func (p2p *Phase2Packet) GetBitSet() BitSet

func (*Phase2Packet) GetGlobuleHashSignature

func (p2p *Phase2Packet) GetGlobuleHashSignature() GlobuleHashSignature

func (*Phase2Packet) GetOrigin added in v0.8.0

func (p2p *Phase2Packet) GetOrigin() core.ShortNodeID

func (*Phase2Packet) GetPulseNumber

func (p2p *Phase2Packet) GetPulseNumber() core.PulseNumber

func (*Phase2Packet) GetTarget added in v0.8.0

func (p2p *Phase2Packet) GetTarget() core.ShortNodeID

func (*Phase2Packet) GetType added in v0.8.0

func (p2p *Phase2Packet) GetType() PacketType

func (*Phase2Packet) GetVotes added in v0.7.5

func (p2p *Phase2Packet) GetVotes() []ReferendumVote

func (*Phase2Packet) IsPhase3Needed added in v0.8.0

func (p2p *Phase2Packet) IsPhase3Needed() bool

func (*Phase2Packet) Serialize

func (p2p *Phase2Packet) Serialize() ([]byte, error)

func (*Phase2Packet) SetBitSet added in v0.7.5

func (p2p *Phase2Packet) SetBitSet(bitset BitSet)

func (*Phase2Packet) SetGlobuleHashSignature

func (p2p *Phase2Packet) SetGlobuleHashSignature(globuleHashSignature []byte) error

func (*Phase2Packet) SetRouting added in v0.8.0

func (p2p *Phase2Packet) SetRouting(origin, target core.ShortNodeID)

func (*Phase2Packet) Sign added in v0.8.0

func (p2p *Phase2Packet) Sign(cryptographyService core.CryptographyService) error

func (*Phase2Packet) Verify added in v0.8.0

func (p2p *Phase2Packet) Verify(crypto core.CryptographyService, key crypto.PublicKey) error

type Phase3Packet

type Phase3Packet struct {
	SignatureHeaderSection1 [SignatureLength]byte
	// contains filtered or unexported fields
}

func NewPhase3Packet

func NewPhase3Packet(number core.PulseNumber, globuleHashSignature GlobuleHashSignature, bitSet BitSet) *Phase3Packet

func (*Phase3Packet) Clone added in v0.8.0

func (p3p *Phase3Packet) Clone() ConsensusPacket

func (*Phase3Packet) Deserialize

func (p3p *Phase3Packet) Deserialize(data io.Reader) error

func (*Phase3Packet) DeserializeWithoutHeader

func (p3p *Phase3Packet) DeserializeWithoutHeader(data io.Reader, header *PacketHeader) error

func (*Phase3Packet) GetBitset

func (p3p *Phase3Packet) GetBitset() BitSet

func (*Phase3Packet) GetGlobuleHashSignature added in v0.8.0

func (p3p *Phase3Packet) GetGlobuleHashSignature() GlobuleHashSignature

func (*Phase3Packet) GetOrigin added in v0.8.0

func (p3p *Phase3Packet) GetOrigin() core.ShortNodeID

func (*Phase3Packet) GetPulseNumber added in v0.8.0

func (p3p *Phase3Packet) GetPulseNumber() core.PulseNumber

func (*Phase3Packet) GetTarget added in v0.8.0

func (p3p *Phase3Packet) GetTarget() core.ShortNodeID

func (*Phase3Packet) GetType added in v0.8.0

func (p3p *Phase3Packet) GetType() PacketType

func (*Phase3Packet) Serialize

func (p3p *Phase3Packet) Serialize() ([]byte, error)

func (*Phase3Packet) SetRouting added in v0.8.0

func (p3p *Phase3Packet) SetRouting(origin, target core.ShortNodeID)

func (*Phase3Packet) Sign added in v0.8.0

func (p3p *Phase3Packet) Sign(cryptographyService core.CryptographyService) error

func (*Phase3Packet) Verify added in v0.8.0

func (p3p *Phase3Packet) Verify(crypto core.CryptographyService, key crypto.PublicKey) error

type PulseData

type PulseData struct {
	PulseNumber uint32
	Data        PulseDataExt
}

PulseData is a pulse data.

func (*PulseData) Deserialize

func (pd *PulseData) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*PulseData) Serialize

func (pd *PulseData) Serialize() ([]byte, error)

Serialize implements interface method

type PulseDataExt

type PulseDataExt struct {
	NextPulseDelta uint16
	PrevPulseDelta uint16
	OriginID       [16]byte
	EpochPulseNo   uint32
	PulseTimestamp uint32
	Entropy        core.Entropy
}

PulseDataExt is a pulse data extension.

func (*PulseDataExt) Deserialize

func (pde *PulseDataExt) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*PulseDataExt) Serialize

func (pde *PulseDataExt) Serialize() ([]byte, error)

Serialize implements interface method

type ReferendumClaim

type ReferendumClaim interface {
	Serializer
	Type() ClaimType
	Clone() ReferendumClaim
}

type ReferendumVote

type ReferendumVote interface {
	Serializer
	Type() VoteType
}

type Serializer

type Serializer interface {
	Serialize() ([]byte, error)
	Deserialize(data io.Reader) error
}

type SignedClaim added in v0.8.0

type SignedClaim interface {
	GetNodeID() core.RecordRef
	GetPublicKey() (crypto.PublicKey, error)
	SerializeRaw() ([]byte, error)
	GetSignature() []byte
}

type SignedPacket added in v0.8.0

type SignedPacket interface {
	Verify(cryptographyService core.CryptographyService, key crypto.PublicKey) error
	Sign(core.CryptographyService) error
}

type StateFraudNodeSupplementaryVote

type StateFraudNodeSupplementaryVote struct {
	Node1PulseProof NodePulseProof
	Node2PulseProof NodePulseProof
	PulseData       PulseData // optional
}

func (*StateFraudNodeSupplementaryVote) Deserialize

func (v *StateFraudNodeSupplementaryVote) Deserialize(data io.Reader) error

Deserialize implements interface method

func (*StateFraudNodeSupplementaryVote) Serialize

func (v *StateFraudNodeSupplementaryVote) Serialize() ([]byte, error)

Serialize implements interface method

func (*StateFraudNodeSupplementaryVote) Type

type TriState

type TriState uint8

TriState is state of the communicating node

const (
	// Legit is bit indicating OK data from node
	Legit TriState = iota + 1
	// TimedOut is bit indicating that timeout occurred when communicating with node
	TimedOut
	// Fraud is bit indicating that the node is malicious (fraud)
	Fraud
)

type TriStateBitSet

type TriStateBitSet struct {
	CompressedSet bool
	// contains filtered or unexported fields
}

TriStateBitSet bitset implementation.

func NewTriStateBitSet

func NewTriStateBitSet(size int) (*TriStateBitSet, error)

NewTriStateBitSet creates and returns a tristatebitset.

func (*TriStateBitSet) ApplyChanges

func (dbs *TriStateBitSet) ApplyChanges(changes []BitSetCell, mapper BitSetMapper) error

func (*TriStateBitSet) GetCells

func (dbs *TriStateBitSet) GetCells(mapper BitSetMapper) ([]BitSetCell, error)

func (*TriStateBitSet) GetTristateArray added in v0.8.0

func (dbs *TriStateBitSet) GetTristateArray() ([]TriState, error)

func (*TriStateBitSet) Serialize

func (dbs *TriStateBitSet) Serialize() ([]byte, error)

type VoteType

type VoteType uint8

Jump to

Keyboard shortcuts

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