Documentation ¶
Overview ¶
In order to describe which nodes have signed a multi-signature, the indecies of the sorted list of consensus participants public keys are encoded into binary objects called BitIDs, this is still in development.
Index ¶
- Variables
- func AddBitIDType(dst BitIDInterface, src BitIDInterface, allowDup bool)
- func CheckIntersectionHelper(b1, b2 NewBitIDInterface) sort.IntSlice
- func GetBitIDFuncs(id types.BitIDType) (FromIntFunc, NewBitIDFunc)
- func HasIntersectionCountHelper(b1, b2 NewBitIDInterface) int
- func HasIntersectionHelper(b1, b2 NewBitIDInterface) bool
- func HasNewItemsBothHelper(b1, b2, b3 NewBitIDInterface) bool
- func HasNewItemsHelper(b1, b2 NewBitIDInterface) bool
- type BIDIter
- type BitID
- func CreateBitIDFromBytes(arr []byte) (*BitID, error)
- func CreateBitIDFromInts(items sort.IntSlice) (*BitID, error)
- func DecodeBitID(buff []byte) (*BitID, error)
- func MergeBitID(bid1 *BitID, bid2 *BitID) *BitID
- func MergeBitIDList(bList ...BitIDInterface) *BitID
- func SubBitID(bid1 *BitID, bid2 *BitID) *BitID
- func (bid *BitID) AddBitID(ID int, allowDup bool, _ *BitIDIterator) bool
- func (bid *BitID) AllowsDuplicates() bool
- func (bid *BitID) AppendItem(v int)
- func (bid *BitID) CheckBitID(ID int) bool
- func (bid *BitID) CheckIntersection(otherint BitIDInterface) sort.IntSlice
- func (bid *BitID) Decode(reader io.Reader) (n int, err error)
- func (bid *BitID) Deserialize(msg *messages.Message) (n int, err error)
- func (bid *BitID) DoEncode() []byte
- func (bid *BitID) DoMakeCopy() NewBitIDInterface
- func (bid *BitID) Done()
- func (bid *BitID) Encode(writer io.Writer) (n int, err error)
- func (bid *BitID) GetBasicInfo() (min, max, count, uniqueCount int)
- func (bid *BitID) GetItemList() sort.IntSlice
- func (bid *BitID) GetNewItems(otherBid BitIDInterface) BitIDInterface
- func (bid *BitID) GetNumItems() int
- func (bid *BitID) GetStr() string
- func (bid *BitID) HasIntersection(otherint BitIDInterface) bool
- func (bid *BitID) HasNewItems(otherint BitIDInterface) bool
- func (bid *BitID) MakeCopy() BitIDInterface
- func (bid *BitID) New() NewBitIDInterface
- func (bid *BitID) NewIterator() BIDIter
- func (bid *BitID) NextID(iter *BitIDIterator) (nxt int, err error)
- func (bid *BitID) SetInitialSize(v int)
- type BitIDInterface
- func CreateBitIDTypeFromInts(items sort.IntSlice) (BitIDInterface, error)
- func DecodeBitIDType(buff []byte) (BitIDInterface, error)
- func MergeBitIDListType(allowDuplicates bool, bList ...BitIDInterface) BitIDInterface
- func MergeBitIDType(b1 BitIDInterface, b2 BitIDInterface, allowDuplicates bool) BitIDInterface
- func SubBitIDType(b1 BitIDInterface, b2 BitIDInterface) BitIDInterface
- type BitIDIterator
- type BitIDPool
- type BitIDPoolInterface
- type ChooseBid
- func (bid *ChooseBid) AllowsDuplicates() bool
- func (bid *ChooseBid) AppendItem(v int)
- func (bid *ChooseBid) Decode(reader io.Reader) (n int, err error)
- func (bid *ChooseBid) Deserialize(msg *messages.Message) (n int, err error)
- func (bid *ChooseBid) DoMakeCopy() NewBitIDInterface
- func (bid *ChooseBid) Done()
- func (bid *ChooseBid) Encode(writer io.Writer) (n int, err error)
- func (bid *ChooseBid) GetBasicInfo() (min, max, count, uniqueCount int)
- func (bid *ChooseBid) GetItemList() sort.IntSlice
- func (bid *ChooseBid) GetStr() string
- func (bid *ChooseBid) New() NewBitIDInterface
- func (bid *ChooseBid) NewIterator() BIDIter
- func (bid *ChooseBid) SetInitialSize(int)
- type ConcurrentBitIDPool
- type DoneFunc
- type FromIntFunc
- type MultiBitID
- func CreateMultiBitIDFromInts(items sort.IntSlice) (*MultiBitID, error)
- func DecodeMultiBitID(buff []byte) (*MultiBitID, error)
- func MergeMultiBitID(bid1 *MultiBitID, bid2 *MultiBitID) *MultiBitID
- func MergeMultiBitIDList(bidList ...BitIDInterface) *MultiBitID
- func MergeMultiBitIDNoDup(bid1 *MultiBitID, bid2 *MultiBitID) *MultiBitID
- func SubMultiBitID(bid1 *MultiBitID, bid2 *MultiBitID) *MultiBitID
- func (bid *MultiBitID) AddBitID(ID int, allowDup bool, iter *BitIDIterator) bool
- func (bid *MultiBitID) AllowsDuplicates() bool
- func (bid *MultiBitID) AppendItem(v int)
- func (bid *MultiBitID) CheckBitID(ID int) bool
- func (bid *MultiBitID) CheckIntersection(otherint BitIDInterface) sort.IntSlice
- func (bid *MultiBitID) Decode(reader io.Reader) (n int, err error)
- func (bid *MultiBitID) Deserialize(msg *messages.Message) (n int, err error)
- func (bid *MultiBitID) DoEncode() []byte
- func (bid *MultiBitID) DoMakeCopy() NewBitIDInterface
- func (bid *MultiBitID) Done()
- func (bid *MultiBitID) Encode(writer io.Writer) (n int, err error)
- func (bid *MultiBitID) GetBasicInfo() (min, max, count, uniqueCount int)
- func (bid *MultiBitID) GetItemList() sort.IntSlice
- func (bid *MultiBitID) GetNewItems(otherint BitIDInterface) BitIDInterface
- func (bid *MultiBitID) GetNumItems() int
- func (bid *MultiBitID) GetStr() string
- func (bid *MultiBitID) HasIntersection(otherint BitIDInterface) bool
- func (bid *MultiBitID) HasNewItems(otherint BitIDInterface) bool
- func (bid *MultiBitID) MakeCopy() BitIDInterface
- func (bid *MultiBitID) New() NewBitIDInterface
- func (bid *MultiBitID) NewIterator() BIDIter
- func (bid *MultiBitID) NextID(iter *BitIDIterator) (nxt int, err error)
- func (bid *MultiBitID) SetInitialSize(v int)
- type NewBitIDFunc
- type NewBitIDInterface
- func AddHelper(b1, b2 NewBitIDInterface, allowDuplicates, errorOnDuplicate bool, ...) (NewBitIDInterface, error)
- func AddHelperSet(allowDuplicates, errorOnDuplicate bool, newFunc NewBitIDFunc, ...) (NewBitIDInterface, error)
- func GetNewItemsHelper(b1, b2 NewBitIDInterface, newFunc NewBitIDFunc) NewBitIDInterface
- func NewBitIDFromInts(items sort.IntSlice) NewBitIDInterface
- func NewChooseBIDFromInts(items sort.IntSlice) NewBitIDInterface
- func NewMultiBitIDFromInts(items sort.IntSlice) NewBitIDInterface
- func NewPbitidFromInts(items sort.IntSlice) NewBitIDInterface
- func NewSliceBitIDFromInts(from sort.IntSlice) NewBitIDInterface
- func NewUvarintBitIDFromInts(items sort.IntSlice) NewBitIDInterface
- func SubHelper(b1, b2 NewBitIDInterface, safeSub SafeSubType, newFunc NewBitIDFunc, ...) (NewBitIDInterface, error)
- type Pbitid
- func (bid *Pbitid) AllowsDuplicates() bool
- func (bid *Pbitid) AppendItem(nxt int)
- func (bid *Pbitid) CheckBitID(int) bool
- func (bid *Pbitid) Decode(reader io.Reader) (n int, err error)
- func (bid *Pbitid) Deserialize(msg *messages.Message) (n int, err error)
- func (bid *Pbitid) DoEncode() []byte
- func (bid *Pbitid) DoMakeCopy() NewBitIDInterface
- func (bid *Pbitid) Done()
- func (bid *Pbitid) Encode(writer io.Writer) (n int, err error)
- func (bid *Pbitid) GetBasicInfo() (min, max, count, uniqueCount int)
- func (bid *Pbitid) GetItemList() sort.IntSlice
- func (bid *Pbitid) GetStr() string
- func (bid *Pbitid) New() NewBitIDInterface
- func (bid *Pbitid) NewIterator() BIDIter
- func (bid *Pbitid) SetInitialSize(int)
- type SafeSubType
- type SliceBitID
- func (bid *SliceBitID) AllowsDuplicates() bool
- func (bid *SliceBitID) AppendItem(v int)
- func (bid *SliceBitID) CheckBitID(v int) bool
- func (bid *SliceBitID) Decode(reader io.Reader) (n int, err error)
- func (bid *SliceBitID) Deserialize(msg *messages.Message) (n int, err error)
- func (bid *SliceBitID) DoMakeCopy() NewBitIDInterface
- func (bid *SliceBitID) Done()
- func (bid *SliceBitID) Encode(writer io.Writer) (n int, err error)
- func (bid *SliceBitID) GetBasicInfo() (min, max, count, uniqueItemCount int)
- func (bid *SliceBitID) GetItemList() sort.IntSlice
- func (bid *SliceBitID) GetStr() string
- func (bid *SliceBitID) New() NewBitIDInterface
- func (bid *SliceBitID) NewIterator() BIDIter
- func (bid *SliceBitID) SetInitialSize(v int)
- type UvarintBitID
- func (bid *UvarintBitID) AllowsDuplicates() bool
- func (bid *UvarintBitID) AppendItem(v int)
- func (bid *UvarintBitID) CheckBitID(v int) bool
- func (bid *UvarintBitID) Decode(reader io.Reader) (n int, err error)
- func (bid *UvarintBitID) Deserialize(msg *messages.Message) (n int, err error)
- func (bid *UvarintBitID) DoMakeCopy() NewBitIDInterface
- func (bid *UvarintBitID) Done()
- func (bid *UvarintBitID) Encode(writer io.Writer) (n int, err error)
- func (bid *UvarintBitID) GetBasicInfo() (min, max, count, uniqueCount int)
- func (bid *UvarintBitID) GetItemList() sort.IntSlice
- func (bid *UvarintBitID) GetStr() string
- func (bid *UvarintBitID) New() NewBitIDInterface
- func (bid *UvarintBitID) NewIterator() BIDIter
- func (bid *UvarintBitID) SetInitialSize(v int)
Constants ¶
This section is empty.
Variables ¶
var NewBitIDFuncs = []FromIntFunc{NewBitIDFromInts, NewMultiBitIDFromInts, NewSliceBitIDFromInts, NewUvarintBitIDFromInts}
Functions ¶
func AddBitIDType ¶
func AddBitIDType(dst BitIDInterface, src BitIDInterface, allowDup bool)
func CheckIntersectionHelper ¶
func CheckIntersectionHelper(b1, b2 NewBitIDInterface) sort.IntSlice
CheckIntersectionHelper returns the items in both bitid (allows duplicates)
func GetBitIDFuncs ¶
func GetBitIDFuncs(id types.BitIDType) (FromIntFunc, NewBitIDFunc)
func HasIntersectionCountHelper ¶
func HasIntersectionCountHelper(b1, b2 NewBitIDInterface) int
IntersectionCountHelper returns the number of intersecting items (allows duplicates).
func HasIntersectionHelper ¶
func HasIntersectionHelper(b1, b2 NewBitIDInterface) bool
HasIntersectionHelper returns true if there is at least one item commit to both bitids
func HasNewItemsBothHelper ¶
func HasNewItemsBothHelper(b1, b2, b3 NewBitIDInterface) bool
HasNewItemsBothHelper returns true if b3 has at least one item not in b1 and not in b2
func HasNewItemsHelper ¶
func HasNewItemsHelper(b1, b2 NewBitIDInterface) bool
HasNewItemsHelper returns true if b2 has at least one item not in b1. Duplicates are only checked once.
Types ¶
type BitID ¶
type BitID struct { Buff []byte // This are the encoded indecies // contains filtered or unexported fields }
A BitID stores a set of indecies as an array of bytes
func CreateBitIDFromBytes ¶
CreateBitIDFromBytes does not copy the byte slice and may modify it when adding new items
func CreateBitIDFromInts ¶
CreateBitIDFromInts does not clopy the int slice and may modify it when adding new items
func DecodeBitID ¶
func MergeBitID ¶
func MergeBitIDList ¶
func MergeBitIDList(bList ...BitIDInterface) *BitID
func SubBitID ¶
SubBitID assumes bid1 and bid2 are already valid to subtract bid 2 is the smaller one
func (*BitID) AllowsDuplicates ¶
AllowDuplicates returns false.
func (*BitID) AppendItem ¶
Append an item at the end of the bitID (must be bigger than all existing items)
func (*BitID) CheckBitID ¶
func (*BitID) CheckIntersection ¶
func (bid *BitID) CheckIntersection(otherint BitIDInterface) sort.IntSlice
func (*BitID) DoMakeCopy ¶
func (bid *BitID) DoMakeCopy() NewBitIDInterface
func (*BitID) GetBasicInfo ¶
Returns the smallest element, the largest element, and the total number of elements
func (*BitID) GetItemList ¶
func (*BitID) GetNewItems ¶
func (bid *BitID) GetNewItems(otherBid BitIDInterface) BitIDInterface
func (*BitID) GetNumItems ¶
func (*BitID) HasIntersection ¶
func (bid *BitID) HasIntersection(otherint BitIDInterface) bool
func (*BitID) HasNewItems ¶
func (bid *BitID) HasNewItems(otherint BitIDInterface) bool
func (*BitID) MakeCopy ¶
func (bid *BitID) MakeCopy() BitIDInterface
func (*BitID) New ¶
func (bid *BitID) New() NewBitIDInterface
func (*BitID) NewIterator ¶
func (*BitID) SetInitialSize ¶
Allocate the expected initial size
type BitIDInterface ¶
type BitIDInterface interface { MakeCopy() BitIDInterface DoEncode() []byte GetNumItems() int // Returns the number of items in the bitID GetNewItems(BitIDInterface) BitIDInterface // Returns a bitID of all the items in the agrument bitid and not in the bitid calling the function (does not return duplicates) HasNewItems(BitIDInterface) bool // Returns true if the argument bitid has at least one item not in the bitid calling the function CheckIntersection(BitIDInterface) sort.IntSlice // Return the items in both bitid (allows duplicates) CheckBitID(int) bool // Returns true if the argument is in the bid AddBitID(id int, allowDup bool, iter *BitIDIterator) bool // Adds the argument to the bid and returns if successful (if allowDup is true then always returns true) GetItemList() sort.IntSlice // Returns the list of items of the bitid GetStr() string // Gets the string representation of the bitid HasIntersection(BitIDInterface) bool // Returns true if there is at least one item commit to both bitids // For iteration NextID(iter *BitIDIterator) (nxt int, err error) // For iterating through the bitid, an iterator is created using NewBitIDIterator(), returns an error if the iterator has traversed all items }
func CreateBitIDTypeFromInts ¶
func CreateBitIDTypeFromInts(items sort.IntSlice) (BitIDInterface, error)
func DecodeBitIDType ¶
func DecodeBitIDType(buff []byte) (BitIDInterface, error)
func MergeBitIDListType ¶
func MergeBitIDListType(allowDuplicates bool, bList ...BitIDInterface) BitIDInterface
func MergeBitIDType ¶
func MergeBitIDType(b1 BitIDInterface, b2 BitIDInterface, allowDuplicates bool) BitIDInterface
func SubBitIDType ¶
func SubBitIDType(b1 BitIDInterface, b2 BitIDInterface) BitIDInterface
type BitIDIterator ¶
type BitIDIterator struct {
// contains filtered or unexported fields
}
func NewBitIDIterator ¶
func NewBitIDIterator() *BitIDIterator
func (*BitIDIterator) Done ¶
func (iter *BitIDIterator) Done()
Done is called when the iterator is no longer needed
func (*BitIDIterator) NextID ¶
func (iter *BitIDIterator) NextID() (nxt int, err error)
For iterating through the bitid, an iterator is created using NewBitIDIterator(), returns an error if the iterator has traversed all items
type BitIDPool ¶
type BitIDPool struct {
// contains filtered or unexported fields
}
func (*BitIDPool) Done ¶
func (bp *BitIDPool) Done(bid NewBitIDInterface)
func (*BitIDPool) Get ¶
func (bp *BitIDPool) Get() NewBitIDInterface
type BitIDPoolInterface ¶
type BitIDPoolInterface interface { Done(NewBitIDInterface) Get() NewBitIDInterface }
func NewBitIDPool ¶
func NewBitIDPool(idFunc NewBitIDFunc, allowConcurrency bool) BitIDPoolInterface
type ChooseBid ¶
type ChooseBid struct { NewBitIDInterface // contains filtered or unexported fields }
func (*ChooseBid) AllowsDuplicates ¶
AllowDuplicates returns true.
func (*ChooseBid) AppendItem ¶
Append an item at the end of the bitID (must be bigger than all existing items)
func (*ChooseBid) Deserialize ¶
func (*ChooseBid) DoMakeCopy ¶
func (bid *ChooseBid) DoMakeCopy() NewBitIDInterface
DoMakeCopy returns a copy of the bit id.
func (*ChooseBid) Done ¶
func (bid *ChooseBid) Done()
Done is called when this item is no longer needed
func (*ChooseBid) GetBasicInfo ¶
Returns the smallest element, the largest element, and the total number of elements
func (*ChooseBid) GetItemList ¶
Returns the list of items of the bitid
func (*ChooseBid) NewIterator ¶
Returns a new iterator of the bit id
func (*ChooseBid) SetInitialSize ¶
Allocate the expected initial size
type ConcurrentBitIDPool ¶
type ConcurrentBitIDPool struct {
// contains filtered or unexported fields
}
func (*ConcurrentBitIDPool) Done ¶
func (bp *ConcurrentBitIDPool) Done(bid NewBitIDInterface)
func (*ConcurrentBitIDPool) Get ¶
func (bp *ConcurrentBitIDPool) Get() NewBitIDInterface
type DoneFunc ¶
type DoneFunc func(NewBitIDInterface) // Called when the input is finished.
type FromIntFunc ¶
type FromIntFunc func(slice sort.IntSlice) NewBitIDInterface
type MultiBitID ¶
type MultiBitID struct {
// contains filtered or unexported fields
}
func CreateMultiBitIDFromInts ¶
func CreateMultiBitIDFromInts(items sort.IntSlice) (*MultiBitID, error)
CreateMultiBitIDFromInts does not clopy the int slice and may modify it when adding new items
func DecodeMultiBitID ¶
func DecodeMultiBitID(buff []byte) (*MultiBitID, error)
func MergeMultiBitID ¶
func MergeMultiBitID(bid1 *MultiBitID, bid2 *MultiBitID) *MultiBitID
func MergeMultiBitIDList ¶
func MergeMultiBitIDList(bidList ...BitIDInterface) *MultiBitID
func MergeMultiBitIDNoDup ¶
func MergeMultiBitIDNoDup(bid1 *MultiBitID, bid2 *MultiBitID) *MultiBitID
func SubMultiBitID ¶
func SubMultiBitID(bid1 *MultiBitID, bid2 *MultiBitID) *MultiBitID
SubMultiBitID assumes bid1 and bid2 are already valid to subtract bid 2 is the smaller one
func (*MultiBitID) AddBitID ¶
func (bid *MultiBitID) AddBitID(ID int, allowDup bool, iter *BitIDIterator) bool
func (*MultiBitID) AllowsDuplicates ¶
func (bid *MultiBitID) AllowsDuplicates() bool
AllowDuplicates returns true.
func (*MultiBitID) AppendItem ¶
func (bid *MultiBitID) AppendItem(v int)
AppendItem appends an item at the end of the bitID (must be bigger than all existing items)
func (*MultiBitID) CheckBitID ¶
func (bid *MultiBitID) CheckBitID(ID int) bool
func (*MultiBitID) CheckIntersection ¶
func (bid *MultiBitID) CheckIntersection(otherint BitIDInterface) sort.IntSlice
func (*MultiBitID) Deserialize ¶
func (bid *MultiBitID) Deserialize(msg *messages.Message) (n int, err error)
func (*MultiBitID) DoEncode ¶
func (bid *MultiBitID) DoEncode() []byte
func (*MultiBitID) DoMakeCopy ¶
func (bid *MultiBitID) DoMakeCopy() NewBitIDInterface
func (*MultiBitID) Done ¶
func (bid *MultiBitID) Done()
Done is called when this item is no longer needed
func (*MultiBitID) GetBasicInfo ¶
func (bid *MultiBitID) GetBasicInfo() (min, max, count, uniqueCount int)
GetBasicInfo returns the smallest element, the largest element, and the total number of elements
func (*MultiBitID) GetItemList ¶
func (bid *MultiBitID) GetItemList() sort.IntSlice
func (*MultiBitID) GetNewItems ¶
func (bid *MultiBitID) GetNewItems(otherint BitIDInterface) BitIDInterface
GetNewItems does not return duplicates
func (*MultiBitID) GetNumItems ¶
func (bid *MultiBitID) GetNumItems() int
func (*MultiBitID) GetStr ¶
func (bid *MultiBitID) GetStr() string
func (*MultiBitID) HasIntersection ¶
func (bid *MultiBitID) HasIntersection(otherint BitIDInterface) bool
func (*MultiBitID) HasNewItems ¶
func (bid *MultiBitID) HasNewItems(otherint BitIDInterface) bool
func (*MultiBitID) MakeCopy ¶
func (bid *MultiBitID) MakeCopy() BitIDInterface
func (*MultiBitID) New ¶
func (bid *MultiBitID) New() NewBitIDInterface
func (*MultiBitID) NewIterator ¶
func (bid *MultiBitID) NewIterator() BIDIter
func (*MultiBitID) NextID ¶
func (bid *MultiBitID) NextID(iter *BitIDIterator) (nxt int, err error)
func (*MultiBitID) SetInitialSize ¶
func (bid *MultiBitID) SetInitialSize(v int)
SetInitialSize allocates the expected initial size
type NewBitIDFunc ¶
type NewBitIDFunc func() NewBitIDInterface
type NewBitIDInterface ¶
type NewBitIDInterface interface { New() NewBitIDInterface // New allocates a new bit id. DoMakeCopy() NewBitIDInterface // DoMakeCopy returns a copy of the bit id. // GetNumItems() int // Returns the number of items in the bitID // CheckBitID(int) bool // Returns true if the argument is in the bid GetItemList() sort.IntSlice // Returns the list of items of the bitid GetStr() string // Gets the string representation of the bitid NewIterator() BIDIter // Returns a new iterator of the bit id GetBasicInfo() (min, max, count, uniqueCount int) // Returns the smallest element, the largest element, and the total number of elements SetInitialSize(int) // Allocate the expected initial size AppendItem(int) // Append an item at the end of the bitID (must be bigger than all existing items) AllowsDuplicates() bool // AllowDuplicates returns true if the bit ID allows duplicate elements Done() // Done is called when this item is no longer needed Encode(writer io.Writer) (n int, err error) Decode(reader io.Reader) (n int, err error) Deserialize(msg *messages.Message) (n int, err error) }
func AddHelper ¶
func AddHelper(b1, b2 NewBitIDInterface, allowDuplicates, errorOnDuplicate bool, newFunc NewBitIDFunc, freeB1 DoneFunc) (NewBitIDInterface, error)
AddHelper adds the items in b2 to b1. If allowsDuplicates is false then duplicates will only be counted once. If errorOnDuplicate it true then an error will be returned if a duplicate is found. If freeB1 is non-nil, then it will be called on b1.
func AddHelperSet ¶
func AddHelperSet(allowDuplicates, errorOnDuplicate bool, newFunc NewBitIDFunc, bids ...NewBitIDInterface) (NewBitIDInterface, error)
AddHelper adds the items in the bitids together. If allowsDuplicates is false then duplicates will only be counted once. If errorOnDuplicate it true then an error will be returned if a duplicate is found. If freeB1 is non-nil, then it will be called on b1.
func GetNewItemsHelper ¶
func GetNewItemsHelper(b1, b2 NewBitIDInterface, newFunc NewBitIDFunc) NewBitIDInterface
GetNewItemsHelper returns a bitID of all the items in b2 and not in b1 (does not return duplicates)
func NewBitIDFromInts ¶
func NewBitIDFromInts(items sort.IntSlice) NewBitIDInterface
func NewChooseBIDFromInts ¶
func NewChooseBIDFromInts(items sort.IntSlice) NewBitIDInterface
func NewMultiBitIDFromInts ¶
func NewMultiBitIDFromInts(items sort.IntSlice) NewBitIDInterface
func NewPbitidFromInts ¶
func NewPbitidFromInts(items sort.IntSlice) NewBitIDInterface
func NewSliceBitIDFromInts ¶
func NewSliceBitIDFromInts(from sort.IntSlice) NewBitIDInterface
NewSliceBitIDFromInts allocates a SliceBitID from the int slice
func NewUvarintBitIDFromInts ¶
func NewUvarintBitIDFromInts(items sort.IntSlice) NewBitIDInterface
func SubHelper ¶
func SubHelper(b1, b2 NewBitIDInterface, safeSub SafeSubType, newFunc NewBitIDFunc, freeB1 DoneFunc) (NewBitIDInterface, error)
SubHelper subtracts b2 from b1 (allows duplicates). If safeSub is true then all b1 must contain all items in b2. If freeB1 is non nil, then it will be called on b1.
type Pbitid ¶
type Pbitid struct {
// contains filtered or unexported fields
}
func (*Pbitid) AllowsDuplicates ¶
AllowDuplicates returns true.
func (*Pbitid) AppendItem ¶
func (*Pbitid) CheckBitID ¶
CheckBitID returns true if the argument is in the bid
func (*Pbitid) Deserialize ¶
func (*Pbitid) DoMakeCopy ¶
func (bid *Pbitid) DoMakeCopy() NewBitIDInterface
DoMakeCopy returns a copy of the bit id.
func (*Pbitid) GetBasicInfo ¶
GetBasicInfo returns the smallest element, the largest element, and the total number of elements
func (*Pbitid) GetItemList ¶
func (*Pbitid) New ¶
func (bid *Pbitid) New() NewBitIDInterface
func (*Pbitid) NewIterator ¶
NewIterator Returns a new iterator of the bit id.
type SafeSubType ¶
type SafeSubType int
const ( NotSafe SafeSubType = iota // subtract any two bit ids NonIntersecting // fail if the one being subtracted is not contained in the outter one NonIntersectingAndEmpty // also fail is the resulting bid id would be empty )
type SliceBitID ¶
type SliceBitID struct {
// contains filtered or unexported fields
}
func (*SliceBitID) AllowsDuplicates ¶
func (bid *SliceBitID) AllowsDuplicates() bool
AllowDuplicates returns true.
func (*SliceBitID) AppendItem ¶
func (bid *SliceBitID) AppendItem(v int)
Append an item at the end of the bitID (must be bigger than all existing items)
func (*SliceBitID) CheckBitID ¶
func (bid *SliceBitID) CheckBitID(v int) bool
Returns true if the argument is in the bid
func (*SliceBitID) Deserialize ¶
func (bid *SliceBitID) Deserialize(msg *messages.Message) (n int, err error)
func (*SliceBitID) DoMakeCopy ¶
func (bid *SliceBitID) DoMakeCopy() NewBitIDInterface
DoMakeCopy returns a copy of the bit id.
func (*SliceBitID) Done ¶
func (bid *SliceBitID) Done()
Done is called when this item is no longer needed
func (*SliceBitID) GetBasicInfo ¶
func (bid *SliceBitID) GetBasicInfo() (min, max, count, uniqueItemCount int)
Returns the smallest element, the largest element, and the total number of elements
func (*SliceBitID) GetItemList ¶
func (bid *SliceBitID) GetItemList() sort.IntSlice
Returns the list of items of the bitid
func (*SliceBitID) GetStr ¶
func (bid *SliceBitID) GetStr() string
Gets the string representation of the bitid
func (*SliceBitID) New ¶
func (bid *SliceBitID) New() NewBitIDInterface
New allocates a new empty bit id.
func (*SliceBitID) NewIterator ¶
func (bid *SliceBitID) NewIterator() BIDIter
func (*SliceBitID) SetInitialSize ¶
func (bid *SliceBitID) SetInitialSize(v int)
Allocate the expected initial size
type UvarintBitID ¶
type UvarintBitID struct {
// contains filtered or unexported fields
}
func (*UvarintBitID) AllowsDuplicates ¶
func (bid *UvarintBitID) AllowsDuplicates() bool
AllowDuplicates returns true.
func (*UvarintBitID) AppendItem ¶
func (bid *UvarintBitID) AppendItem(v int)
Append an item at the end of the bitID (must be bigger than all existing items)
func (*UvarintBitID) CheckBitID ¶
func (bid *UvarintBitID) CheckBitID(v int) bool
Returns true if the argument is in the bid
func (*UvarintBitID) Deserialize ¶
func (bid *UvarintBitID) Deserialize(msg *messages.Message) (n int, err error)
func (*UvarintBitID) DoMakeCopy ¶
func (bid *UvarintBitID) DoMakeCopy() NewBitIDInterface
func (*UvarintBitID) Done ¶
func (bid *UvarintBitID) Done()
Done is called when this item is no longer needed
func (*UvarintBitID) GetBasicInfo ¶
func (bid *UvarintBitID) GetBasicInfo() (min, max, count, uniqueCount int)
Returns the smallest element, the largest element, and the total number of elements
func (*UvarintBitID) GetItemList ¶
func (bid *UvarintBitID) GetItemList() sort.IntSlice
Returns the list of items of the bitid
func (*UvarintBitID) GetStr ¶
func (bid *UvarintBitID) GetStr() string
Gets the string representation of the bitid
func (*UvarintBitID) New ¶
func (bid *UvarintBitID) New() NewBitIDInterface
func (*UvarintBitID) NewIterator ¶
func (bid *UvarintBitID) NewIterator() BIDIter
func (*UvarintBitID) SetInitialSize ¶
func (bid *UvarintBitID) SetInitialSize(v int)
Allocate the expected initial size