Class: RangeFilter
One Range Filter parameter. Unlike other parameters it may repeat in a message, once per SetID (and Property Type).
Without a setId it is the zero-length form, which in REQUEST_UPDATE removes the filters of its kind.
The Ranges are held as the wire's deltas and only added back by RangeFilter.ranges: a sum past 2^64-1 is answered with a REQUEST_ERROR for the request that carried it, which a parser that rejected it could not do.
Implements
Constructors
Constructor
new RangeFilter(
kind,setId?,propertyType?,deltas?):RangeFilter
Parameters
kind
setId?
number
propertyType?
bigint
deltas?
readonly RangeDelta[] = []
Returns
RangeFilter
Throws
:ProtocolViolationError When the Property Type's presence does not match the kind, or a removal carries anything but its kind.
Properties
deltas
readonlydeltas: readonlyRangeDelta[] =[]
kind
readonlykind:RangeFilterKind
propertyType?
readonlyoptionalpropertyType?:bigint
setId?
readonlyoptionalsetId?:number
Accessors
isRemoval
Get Signature
get isRemoval():
boolean
The zero-length form, which removes the filters of its kind.
Returns
boolean
rangeCount
Get Signature
get rangeCount():
number
How many Ranges the filter holds, which is what a peer's range limit counts.
Returns
number
Methods
ranges()
ranges():
Range[]
The Ranges with their deltas added back.
Returns
Range[]
Throws
:InvalidFilterError When a bound exceeds 2^64-1.
serializeValue()
serializeValue():
Uint8Array
The SetID, Property Type if any, and the Ranges, without the Type or Length.
Returns
Uint8Array
toKeyValuePair()
toKeyValuePair():
KeyValuePair
Returns
Implementation of
validate()
validate():
Range[]
The Ranges, once everything a filter of this kind has to satisfy holds.
Returns
Range[]
Throws
:InvalidFilterError For an odd Property Type, a priority above 255, or a bound past 2^64-1.
fromKeyValuePair()
staticfromKeyValuePair(pair):RangeFilter|undefined
Decodes a Range Filter value. The Value ends with the last Range, so a Start with nothing after it is an open-ended last Range.
Parameters
pair
Returns
RangeFilter | undefined