core: span allocation with shared free list and geometric growth
Amp-Thread-ID: https://ampcode.com/threads/T-01a0b2dd-db32-712d-99ce-12ce4a86d979 Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
+3
-2
@@ -97,9 +97,10 @@ export class YawnCore {
|
||||
this.#arrays.delete(name);
|
||||
}
|
||||
|
||||
async allocateObject(name) {
|
||||
/** Reserves `count` contiguous rows and resolves with the first row ID. */
|
||||
async allocateObject(name, count = 1) {
|
||||
await this.ready;
|
||||
const { id, rows } = await this.#request("allocate-object", { name });
|
||||
const { id, rows } = await this.#request("allocate-object", { name, count });
|
||||
this.#arrays.get(name).update(rows);
|
||||
return id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user