1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

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
This commit is contained in:
stephan
2023-07-26 11:11:39 +00:00
parent 3ba6914121
commit aef4fbf203
4 changed files with 38 additions and 11 deletions

View File

@ -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