Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/willow/src/wgps/guaranteed_queue.ts>GuaranteedQueue

A Willow Data Model and Willow General Purpose Sync protocol implementation in TypeScript.
Latest
class GuaranteedQueue
import { GuaranteedQueue } from "https://deno.land/x/willow@0.3.5/src/wgps/guaranteed_queue.ts";

A FIFO queue which does not emit data until it has received guarantees that the data will be accepted.

https://willowprotocol.org/specs/resource-control/index.html#resource_control_overview

Properties

private
outgoingBytes: FIFO<Uint8Array>

Bytes which have been guaranteed to be accepted by the server.

private
queue: FIFO<Uint8Array>

Bytes awaiting guarantees before being sent.

guarantees: bigint

The guarantees received from the server.

Methods

private
useGuarantees()

Use available guarantees to send bytes.

addGuarantees(bytes: bigint)

Add guarantees received from the server.

plead(targetSize: bigint): bigint

Received a plea from the server to shrink the buffer to a certain size.

This implementation always absolves them.

push(bytes: Uint8Array)

Add some bytes to the queue.