Skip to content

Class: RequestIdMap ​

A bidirectional map between requestId (bigint) and full track names. Used to efficiently look up either by requestId or by name, enforcing uniqueness.

Constructors ​

Constructor ​

new RequestIdMap(): RequestIdMap

Returns ​

RequestIdMap

Methods ​

addMapping() ​

addMapping(requestId, name): void

Adds a mapping between a requestId and a full track name.

Parameters ​

requestId ​

bigint

The requestId to associate.

name ​

FullTrackName

The full track name to associate.

Returns ​

void

Throws ​

:RequestIdError if the requestId or name is already mapped to a different value.


containsName() ​

containsName(name): boolean

Checks if the map contains a given full track name.

Parameters ​

name ​

FullTrackName

The full track name to check.

Returns ​

boolean

True if the name exists, false otherwise.


containsRequestId() ​

containsRequestId(requestId): boolean

Checks if the map contains a given requestId.

Parameters ​

requestId ​

bigint

The requestId to check.

Returns ​

boolean

True if the requestId exists, false otherwise.


getNameByRequestId() ​

getNameByRequestId(requestId): FullTrackName

Gets the full track name for a given requestId.

Parameters ​

requestId ​

bigint

The requestId to look up.

Returns ​

FullTrackName

The associated full track name.

Throws ​

:RequestIdError if the requestId does not exist.


getRequestIdByName() ​

getRequestIdByName(name): bigint

Gets the requestId for a given full track name.

Parameters ​

name ​

FullTrackName

The full track name to look up.

Returns ​

bigint

The associated requestId.

Throws ​

:RequestIdError if the name does not exist.


removeMappingByName() ​

removeMappingByName(name): bigint | undefined

Removes a mapping by full track name.

Parameters ​

name ​

FullTrackName

The full track name to remove.

Returns ​

bigint | undefined

The removed requestId, or undefined if not found.


removeMappingByRequestId() ​

removeMappingByRequestId(requestId): FullTrackName | undefined

Removes a mapping by requestId.

Parameters ​

requestId ​

bigint

The requestId to remove.

Returns ​

FullTrackName | undefined

The removed full track name, or undefined if not found.