Documentation
¶
Overview ¶
Package dbitset contains dragon-specific utilities around bitsets.
Index ¶
- func RandomClearBitIterator(bs *bitset.BitSet) iter.Seq[*ClearBit]
- func RandomSetBitIterator(bs *bitset.BitSet) iter.Seq[*SetBit]
- type AdaptiveDecoder
- type AdaptiveEncoder
- type ClearBit
- type CombinationDecoder
- type CombinationEncoder
- type RawDecoder
- type RawEncoder
- type SetBit
- type SnappyDecoder
- type SnappyEncoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomClearBitIterator ¶
RandomClearBitIterator iterates over the cleared bits in bs in a pseudorandom order. The ClearBit return type has an *ClearBit.InPlaceUnion method which can be used to avoid iterating certain bits in this sequence of the current iteration.
Types ¶
type AdaptiveDecoder ¶
type AdaptiveDecoder struct {
// contains filtered or unexported fields
}
func (*AdaptiveDecoder) ReceiveBitset ¶
type AdaptiveEncoder ¶
type AdaptiveEncoder struct {
// contains filtered or unexported fields
}
func (*AdaptiveEncoder) SendBitset ¶
type ClearBit ¶
type ClearBit struct { Idx uint // contains filtered or unexported fields }
ClearBit is the type returned in the RandomClearBitIterator. This is a dedicated type as opposed to a simple uint in order to expose the *ClearBit.InPlaceUnion method.
func (*ClearBit) InPlaceUnion ¶
InPlaceUnion updates b to be the union of b and x. The input argument is not modified or retained. Any set bits in x will be skipped in following iterations through b.
In most use cases there will be a separate "tracking" bitset that also needs updated.
type CombinationDecoder ¶
type CombinationDecoder struct {
// contains filtered or unexported fields
}
CombinationDecoder maintains internal state for decoding compressed bitsets. This internal state reduces allocations as bitsets are decoded.
The zero value of CombinationDecoder is ready to use.
CombinationDecoder is not safe for concurrent use.
func (*CombinationDecoder) ReceiveBitset ¶
func (d *CombinationDecoder) ReceiveBitset( s quic.ReceiveStream, timeout time.Duration, bs *bitset.BitSet, ) error
ReceiveBitset reads a compressed bitset from the given stream, and sets the bs input argument to match that value.
The read deadline for the bitset is determined by the timeout argument. If timeout is positive, that duration is used for the deadline. Otherwise, the read deadline is cleared and the read will block until the data is received or the read is canceled.
The bitset's length (as reported by *bitset.BitSet.Len) must be the same value the remote expects, or else the remote will decode a different value from what we encode here.
type CombinationEncoder ¶
type CombinationEncoder struct {
// contains filtered or unexported fields
}
CombinationEncoder maintains internal state for encoding compressed bitsets. This internal state reduces allocations as bitsets are encoded.
The zero value of CombinationEncoder is ready to use.
CombinationEncoder is not safe for concurrent use.
func (*CombinationEncoder) SendBitset ¶
func (e *CombinationEncoder) SendBitset( s quic.SendStream, timeout time.Duration, bs *bitset.BitSet, ) error
SendBitset writes the compressed form of bs to the given stream. The bitset's length (as reported by *bitset.BitSet.Len) must be the same value the remote expects, or else the remote will decode a different value from what we encode here.
type RawDecoder ¶
type RawDecoder struct {
// contains filtered or unexported fields
}
func (*RawDecoder) ReceiveBitset ¶
type RawEncoder ¶
type RawEncoder struct {
// contains filtered or unexported fields
}
func (*RawEncoder) SendBitset ¶
type SnappyDecoder ¶
type SnappyDecoder struct {
// contains filtered or unexported fields
}
func (*SnappyDecoder) ReceiveBitset ¶
type SnappyEncoder ¶
type SnappyEncoder struct {
// contains filtered or unexported fields
}