diff options
author | stephan <stephan@noemail.net> | 2023-07-26 11:11:39 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2023-07-26 11:11:39 +0000 |
commit | aef4fbf2032894a8b3096953b9aed54763b12e7f (patch) | |
tree | 153a1b6465c624129b31530402f186888358c827 /ext/wasm/api | |
parent | 3ba691412109e192b5e052e5006337f9ba907fbe (diff) | |
download | sqlite-aef4fbf2032894a8b3096953b9aed54763b12e7f.tar.gz sqlite-aef4fbf2032894a8b3096953b9aed54763b12e7f.zip |
Add SAHPoolUtil.getFileNames() method, and tests for it, per [forum:a3da1e34d8|forum feedback]. Add a test to demonstrate that two SAH pools can coexist so long as they have different names.
FossilOrigin-Name: 72dc3f8c3255186ec412412b685b0b51ddcd08240f2353ac742fc7da8c23568e
Diffstat (limited to 'ext/wasm/api')
-rw-r--r-- | ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js index 9bf1421a9..ee8d1a5d6 100644 --- a/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js +++ b/ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js @@ -501,6 +501,15 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ /* Current number of in-use files from pool. */ getFileCount(){return this.#mapFilenameToSAH.size} + /* Returns an array of the names of all + currently-opened client-specified filenames. */ + getFileNames(){ + const rc = []; + const iter = this.#mapFilenameToSAH.keys(); + for(const n of iter) rc.push(n); + return rc; + } + // #createFileObject(sah,clientName,opaqueName){ // const f = Object.assign(Object.create(null),{ // clientName, opaqueName @@ -901,6 +910,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ getCapacity(){ return this.#p.getCapacity(this.#p) } getFileCount(){ return this.#p.getFileCount() } + getFileNames(){ return this.#p.getFileNames() } async reserveMinimumCapacity(min){ const c = this.#p.getCapacity(); @@ -1059,6 +1069,11 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ Returns the number of files from the pool currently allocated to slots. This is not the same as the files being "opened". + - array getFileNames() + + Returns an array of the names of the files currently allocated to + slots. This list is the same length as getFileCount(). + - void importDb(name, byteArray) Imports the contents of an SQLite database, provided as a byte |