new Semaphore(id, size, timeouts)
Semaphore class to hold the id, concurrency limit, and timeouts information for a semaphore. Additional metadata about the holders of a semaphore, such as start time and initial TTL, are stored in the DSem server's underlying table.
Parameters:
Name | Type | Description |
---|---|---|
id |
String | ID of semaphore. |
size |
Number | Concurrency limit of semaphore. |
timeouts |
Map | Map from holders to timeout objects. |
- Source:
Methods
id(idopt) → {String}
Acts as a getter/setter for the ID of this semaphore.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
String |
<optional> |
ID to set on this semaphore. |
- Source:
Returns:
This semaphore's ID.
- Type
- String
size(sizeopt) → {Number}
Acts as a getter/setter for the concurrency limit of this semaphore.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
size |
Number |
<optional> |
Concurrency limit to set on this semaphore. |
- Source:
Returns:
This semaphore's concurrency limit.
- Type
- Number
timeouts(timeoutsopt) → {Map}
Acts as a getter/setter for the timeout map of this semaphore.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
timeouts |
Map |
<optional> |
Timeout map to set on this semaphore. |
- Source:
Returns:
Timeout map of this semaphore.
- Type
- Map