Skip to content

RibltDecoder

Defined in: packages/distillate/src/riblt/decoder.ts:48

The receiving side of rateless set reconciliation: fed a peer’s coded symbols in order, it peels them until it holds exactly the keys that differ between the two sets.

const decoder = RibltDecoder.from(["alice", "carol"]);

K extends BytesLike = BytesLike

new RibltDecoder<K>(params?): RibltDecoder<K>

Defined in: packages/distillate/src/riblt/decoder.ts:77

RibltParams = {}

RibltDecoder<K>

ParamError If seed is not a uint32.

get decoded(): boolean

Defined in: packages/distillate/src/riblt/decoder.ts:113

Whether every received symbol has been peeled: the difference is known.

boolean

add(key): void

Defined in: packages/distillate/src/riblt/decoder.ts:131

Adds a key this side holds. Keys must be distinct, and all added before the first coded symbol arrives.

K

void

ParamError If a coded symbol was already received.


local(): K[]

Defined in: packages/distillate/src/riblt/decoder.ts:157

The keys only this side holds, as they were added. Re-hashes each local key once rather than keeping a hash-to-key map over the whole set.

K[]


push(frame): boolean

Defined in: packages/distillate/src/riblt/decoder.ts:185

Ingests a frame from the peer’s RibltEncoder.take and reports whether the difference is now decoded. Frames must arrive in order. A rejected frame leaves the decoder as it was.

Uint8Array

boolean

RibltParamMismatchError If the frame’s seed differs.

ParamError If the frame does not start at the next symbol this decoder expects. On the first frame, if two local keys hash alike under the seed: a repeated key, or a 64-bit collision that another seed resolves.


remote(): bigint[]

Defined in: packages/distillate/src/riblt/decoder.ts:145

Hashes of the keys only the remote side holds, as RibltDecoder.hashOf gives them.

bigint[]


static from<K>(keys, params?): RibltDecoder<K>

Defined in: packages/distillate/src/riblt/decoder.ts:89

Builds a decoder over this side’s keys, which must be distinct: RibltDecoder.push refuses the first frame otherwise.

K extends BytesLike

Iterable<K>

RibltParams

RibltDecoder<K>

ParamError If seed is not a uint32.


static hashOf(key, seed?): bigint

Defined in: packages/distillate/src/riblt/decoder.ts:106

The 64-bit hash that RibltDecoder.remote reports for key, so the peer holding the key can map a reported hash back to it.

BytesLike

number = 0

bigint

ParamError If seed is not a uint32.