@fails-components/webtransport
Version:
A component to add webtransport support (server and client) to node.js using libquiche
167 lines • 4.37 kB
TypeScript
export class PriorityScheduler {
activeGroups_: BTreeScheduler;
/**
* @type {Object<string, BTreeScheduler>}
*/
perGroupSchedulers_: {
[x: string]: BTreeScheduler;
};
/**
* @type {Object<string, {sendGroupId: SendGroupId, perGroupScheduler: BTreeScheduler }>}
*/
streamToGroupMap_: {
[x: string]: {
sendGroupId: SendGroupId;
perGroupScheduler: BTreeScheduler;
};
};
HasRegistered(): boolean;
HasScheduled(): boolean;
NumScheduled(): number;
/**
* @param {StreamId} streamId
* @param {Priority} priority
*/
Register(streamId: StreamId, priority: Priority): void;
/**
* @param {StreamId} streamId
*/
Unregister(streamId: StreamId): void;
/**
* @param {StreamId} streamId
* @param {bigint} newSendOrder
*/
UpdateSendOrder(streamId: StreamId, newSendOrder: bigint): Error | undefined;
/**
* @param {StreamId} streamId
* @param {SendGroupId} newSendGroup
*/
UpdateSendGroup(streamId: StreamId, newSendGroup: SendGroupId): void;
/**
* @param {StreamId} streamId
*/
ShouldYield(streamId: StreamId): boolean;
/**
* @param {StreamId} streamId
*/
GetPriorityFor(streamId: StreamId): {
sendGroupId: bigint;
sendOrder: bigint;
} | null;
PopFront(): bigint | undefined;
/**
* @param {StreamId} streamId
*/
Schedule(streamId: StreamId): Error | undefined;
/**
* @param {StreamId} streamId
*/
IsScheduled(streamId: StreamId): boolean;
/**
* @param {StreamId} streamId
*/
SchedulerForStream(streamId: StreamId): BTreeScheduler | undefined;
}
export type Priority = {
sendGroupId: SendGroupId;
sendOrder: bigint;
};
export type SendGroupId = bigint;
export type SendOrder = bigint;
export type StreamId = bigint;
export type FullStreamEntry = {
iD: SendGroupId;
streamEntry: StreamEntry;
};
export type ScheduleKey = {
priority: SendOrder;
sequenceNumber: number;
};
declare class BTreeScheduler {
/**
* @param {{scheduleKey: ScheduleKey, fullStreamEntry: FullStreamEntry}} entry
*/
static StreamId(entry: {
scheduleKey: ScheduleKey;
fullStreamEntry: FullStreamEntry;
}): bigint;
/**
* @type {Object<string, StreamEntry>}
*/
streams_: {
[x: string]: StreamEntry;
};
/**
* @type {{scheduleKey: ScheduleKey, fullStreamEntry: FullStreamEntry}[]}
*/
schedule_: {
scheduleKey: ScheduleKey;
fullStreamEntry: FullStreamEntry;
}[];
currentWriteSequenceNumber_: number;
HasRegistered(): boolean;
HasScheduled(): boolean;
NumScheduled(): number;
NumRegistered(): number;
/**
* @param {number} min
* @param {number} max
*/
NumScheduledInPriorityRange(min: number, max: number): number;
/**
* @param {StreamId} streamId
*/
ShouldYield(streamId: StreamId): boolean;
/**
* @param {StreamId} id
*/
GetPriorityFor(id: StreamId): bigint | undefined;
PopFront(): bigint | undefined;
/**
* @param {StreamId} streamId
* @param {Priority} priority
*/
Register(streamId: StreamId, priority: Priority): void;
/**
* @param {StreamId} streamId
*/
Unregister(streamId: StreamId): void;
/**
* @param {StreamId} streamId
* @param {SendOrder} newPriority
*/
UpdatePriority(streamId: StreamId, newPriority: SendOrder): Error | undefined;
/**
* @param {StreamId} streamId
*/
Schedule(streamId: StreamId): Error | undefined;
/**
* @param {StreamId} streamId
*/
Deschedule(streamId: StreamId): void;
/**
* @param {StreamId} streamId
*/
IsScheduled(streamId: StreamId): boolean;
/**
* @param {StreamEntry} entry
*/
DescheduleStream(entry: StreamEntry): {
scheduleKey: ScheduleKey;
fullStreamEntry: FullStreamEntry;
};
}
declare class StreamEntry {
/**
* @param {SendOrder} priority
*/
constructor(priority: SendOrder);
priority: bigint;
/**
* @type {number|undefined}
*/
currentSequenceNumber: number | undefined;
scheduled(): boolean;
}
export {};
//# sourceMappingURL=priorityscheduler.d.ts.map