presidium 4.5.1 → 4.5.3
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 +33 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,15 @@ License: [CFOSS](https://cloutsworld.com/en-us/legal/license/cfoss)
|
|
|
28
28
|
[](https://codecov.io/gh/richytong/presidium-db)
|
|
29
29
|
[](https://www.npmjs.com/package/presidium-db)
|
|
30
30
|
|
|
31
|
+
### Presidium DB Client and Server
|
|
32
|
+
|
|
33
|
+
Source code: [GitHub](https://github.com/richytong/presidium-db-client-server) |
|
|
34
|
+
License: [CFOSS](https://cloutsworld.com/en-us/legal/license/cfoss)
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
[](https://codecov.io/gh/richytong/presidium-db-client-server)
|
|
38
|
+
[](https://www.npmjs.com/package/presidium-db-client-server)
|
|
39
|
+
|
|
31
40
|
## Installation
|
|
32
41
|
with [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm):
|
|
33
42
|
```bash
|
|
@@ -431,16 +440,36 @@ for await (const value of sortedHt.reverseIterator({ startingSortValue: 2, endin
|
|
|
431
440
|
## [Host your own distributed database](https://presidium.services/docs/DatabaseServer)
|
|
432
441
|
```javascript
|
|
433
442
|
const DatabaseServer = require("presidium/DatabaseServer")
|
|
434
|
-
const DiskHashTableClient = require("presidium/DiskHashTableClient")
|
|
435
443
|
|
|
436
444
|
const server = new DatabaseServer({
|
|
437
445
|
databasePath: `${__dirname}/database`,
|
|
438
446
|
})
|
|
439
447
|
await server.init()
|
|
440
448
|
|
|
449
|
+
await server.registerDiskHashTable("Session", {
|
|
450
|
+
storagePath: `${this.databasePath}/Session/storage`,
|
|
451
|
+
headerPath: `${this.databasePath}/Session/header`,
|
|
452
|
+
initialLength: 536870912,
|
|
453
|
+
itemSize: 512,
|
|
454
|
+
})
|
|
455
|
+
|
|
456
|
+
await server.registerDiskSortedHashTable("Post", {
|
|
457
|
+
storagePath: `${this.databasePath}/Post/storage`,
|
|
458
|
+
headerPath: `${this.databasePath}/Post/header`,
|
|
459
|
+
initialLength: 1048576,
|
|
460
|
+
itemSize: 8192,
|
|
461
|
+
sortValueType: "number",
|
|
462
|
+
degree: 2,
|
|
463
|
+
})
|
|
464
|
+
|
|
441
465
|
server.listen(5000, () => {
|
|
442
466
|
console.log("Database server listening on port 5000")
|
|
443
467
|
})
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
## [Call a database table from anywhere](https://presidium.services/docs/DiskHashTableClient)
|
|
471
|
+
```javascript
|
|
472
|
+
const DiskHashTableClient = require("presidium/DiskHashTableClient")
|
|
444
473
|
|
|
445
474
|
const sessionHt = new DiskHashTableClient({
|
|
446
475
|
serverUrl: "http://localhost:5000",
|
|
@@ -457,9 +486,9 @@ const sessionJson = await sessionHt.get(accessToken)
|
|
|
457
486
|
await sessionHt.delete(accessToken)
|
|
458
487
|
```
|
|
459
488
|
|
|
460
|
-
## [Query
|
|
489
|
+
## [Query a database table from anywhere](https://presidium.services/docs/DiskSortedHashTableClient)
|
|
461
490
|
```javascript
|
|
462
|
-
const DiskSortedHashTableClient = require("presidium/DiskSortedHashTableClient")
|
|
491
|
+
const DiskSortedHashTableClient = require("presidium-db-client-server/DiskSortedHashTableClient")
|
|
463
492
|
|
|
464
493
|
const postHt = new DiskSortedHashTableClient({
|
|
465
494
|
serverUrl: "http://localhost:5000",
|
|
@@ -501,5 +530,5 @@ for await (const postJson of postHt.reverseIterator()) {
|
|
|
501
530
|
## License
|
|
502
531
|
Presidium is distributed under the [CFOSS License](https://cloutsworld.com/en-us/legal/license/cfoss).
|
|
503
532
|
|
|
504
|
-
|
|
533
|
+
## Support
|
|
505
534
|
* minimum Node.js version: 16
|