presidium 4.5.1 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -431,16 +431,36 @@ for await (const value of sortedHt.reverseIterator({ startingSortValue: 2, endin
|
|
|
431
431
|
## [Host your own distributed database](https://presidium.services/docs/DatabaseServer)
|
|
432
432
|
```javascript
|
|
433
433
|
const DatabaseServer = require("presidium/DatabaseServer")
|
|
434
|
-
const DiskHashTableClient = require("presidium/DiskHashTableClient")
|
|
435
434
|
|
|
436
435
|
const server = new DatabaseServer({
|
|
437
436
|
databasePath: `${__dirname}/database`,
|
|
438
437
|
})
|
|
439
438
|
await server.init()
|
|
440
439
|
|
|
440
|
+
await server.registerDiskHashTable("Session", {
|
|
441
|
+
storagePath: `${this.databasePath}/Session/storage`,
|
|
442
|
+
headerPath: `${this.databasePath}/Session/header`,
|
|
443
|
+
initialLength: 536870912,
|
|
444
|
+
itemSize: 512,
|
|
445
|
+
})
|
|
446
|
+
|
|
447
|
+
await server.registerDiskSortedHashTable("Post", {
|
|
448
|
+
storagePath: `${this.databasePath}/Post/storage`,
|
|
449
|
+
headerPath: `${this.databasePath}/Post/header`,
|
|
450
|
+
initialLength: 1048576,
|
|
451
|
+
itemSize: 8192,
|
|
452
|
+
sortValueType: "number",
|
|
453
|
+
degree: 2,
|
|
454
|
+
})
|
|
455
|
+
|
|
441
456
|
server.listen(5000, () => {
|
|
442
457
|
console.log("Database server listening on port 5000")
|
|
443
458
|
})
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## [Call a database table from anywhere](https://presidium.services/docs/DiskHashTableClient)
|
|
462
|
+
```javascript
|
|
463
|
+
const DiskHashTableClient = require("presidium/DiskHashTableClient")
|
|
444
464
|
|
|
445
465
|
const sessionHt = new DiskHashTableClient({
|
|
446
466
|
serverUrl: "http://localhost:5000",
|
|
@@ -457,9 +477,9 @@ const sessionJson = await sessionHt.get(accessToken)
|
|
|
457
477
|
await sessionHt.delete(accessToken)
|
|
458
478
|
```
|
|
459
479
|
|
|
460
|
-
## [Query
|
|
480
|
+
## [Query a database table from anywhere](https://presidium.services/docs/DiskSortedHashTableClient)
|
|
461
481
|
```javascript
|
|
462
|
-
const DiskSortedHashTableClient = require("presidium/DiskSortedHashTableClient")
|
|
482
|
+
const DiskSortedHashTableClient = require("presidium-db-client-server/DiskSortedHashTableClient")
|
|
463
483
|
|
|
464
484
|
const postHt = new DiskSortedHashTableClient({
|
|
465
485
|
serverUrl: "http://localhost:5000",
|