@phorbas/store
v0.4.3
Published
Persistent, hashed, opaque, replicable, binary key/content, addressable, storage
Downloads
8
Readme
PHORBAS Store
A PHORBAS store is an associative 1:1 binary key to binary content data storage abstraction. Keys are binary as a result of cryptographic hashing from PHORBAS Opaque, and content is binary as a result of encryption. The store handles the principles of Persistent, Binary key/content, Addressable, and Store.
- PHORBAS Opaque handles the principle of Hashed, Opaque, and Addressable.
- PHORBAS HAMT handles the principle of Replicable.
API & Use
- See
test/api_example.mjs
. - Store API docs
docs/store_api.md
. - Backend storage API docs
docs/bkc_api.md
.
Storage Implementations
Local
| | Technology / Library | Implementation
|----|----------------------|----------------
| ✅ | JS Map (NodeJS) new Map()
| impl: code/js_map.jsy test: test/unittest.node.mjs
| ✅ | JS Map (Web) new Map()
| impl: code/js_map.jsy test: test/unittest.web.mjs
| ✅ | Browser IndexedDB API globalThis.indexedDB.open()
| impl: code/web/web_db.jsy test: test/unittest.web.mjs
| ✅ | Browser Fetch API globalThis.fetch()
| impl: code/web/web_fetch.jsy test: test/unittest.web.mjs
| ✅ | Browser Service Worker Cache API globalThis.caches.open()
| impl: code/web/web_cache.jsy test: test/unittest.web.mjs
| ✅ | Node FS API require('fs')
| impl: code/local/fs.jsy test: test/int--fsp/integ-test.mjs
| ✅ | Node FS Promises API require('fs').promises
| impl: code/local/fsp.jsy test: test/int--fsp/integ-test.mjs
| ✅ | Web FS API lightning-fs from isomorphic-git | impl: code/local/fsp.jsy test: test/unittest.web.mjs
| ✅ | Web FSP Promises API lightning-fs from isomorphic-git | impl: code/local/fsp.jsy test: test/unittest.web.mjs
| ✅ | LMDB node-lmdb | impl: code/nosql/lmdb.jsy test: test/int--level/integ-test.mjs
Also see SQLite and Level-based adapters for local / embedded alternatives.
NoSQL
| | Technology / Library | Implementation |----|----------------------|---------------- | ⚠️ | ArangoDB arangojs | impl: code/nosql/arangojs.jsy test: test/int--arangodb/integ-test.mjs note: Binary values encode in base64 | ⚗️ | Cassandra cassandra-driver | intended; need help setting up Docker integration testing | ⚗️ | Couchbase | intended | ✅ | CouchDB nano | impl: code/nosql/couchdb.jsy test: test/int--couchdb/integ-test.mjs | ✅ | Consul KV node-consul | impl: code/nosql/consulkv.jsy test: test/int--consulkv/integ-test.mjs | ✅ | AWS DynamoDB aws-sdk | impl: code/nosql/dynamodb.jsy test: test/int--dynamodb/integ-test.mjs | ✅ | LMDB node-lmdb | impl: code/nosql/lmdb.jsy test: test/int--level/integ-test.mjs | ✅ | Memcache memjs | impl: code/nosql/memjs.jsy test: test/int--memcache/integ-test.mjs | ✅ | MongoDB mongojs | impl: code/nosql/mongojs.jsy test: test/int--mongodb/integ-test.mjs | ✅ | PouchDB pouchdb | impl: code/nosql/pouchdb.jsy test node: test/unittest.web.mjs test web: test/unittest.web.mjs test with couchdb: test/int--couchdb/integ-test.mjs | ✅ | Redis ioredis | impl: code/nosql/ioredis.jsy test: test/int--redis/integ-test.mjs | ✅ | RethinkDB rethinkdb | impl: code/nosql/rethinkdb.jsy test: test/int--rethinkdb/integ-test.mjs | ⚗️ | ScyllaDB cassandra-driver | intended; need help setting up Docker integration testing
S3 NoSQL
| | Technology / Library | Implementation |----|----------------------|---------------- | ✅ | MinIO minio | impl: code/nosql/minio.jsy test: test/int--s3api/integ-test.mjs | ✅ | AWS S3 or compatible aws4fetch | impl: code/nosql/s3_aws4fetch.jsy test: test/unittest.web.mjs
Also see s3leveldown
Level-based adapter.
SQL and Knex adapter
| | Technology / Library | Implementation |----|----------------------|---------------- | ✅ | SQLite node-sqlite3 | impl: code/sql/sqlite.jsy test: test/int--sqlite3/integ-test.mjs | ✅ | SQLite knex.js | impl: code/sql/knex.jsy test: test/int--sqlite3/integ-test.mjs | ✅ | PostgreSQL knex.js | impl: code/sql/knex.jsy test: test/int--postgres/integ-test.mjs | ✅ | CockroachDB knex.js | impl: code/sql/knex.jsy test: test/int--postgres/integ-test.mjs | ❌ | CrateDB knex.js | impl: code/sql/knex.jsy test: test/int--postgres/integ-test.mjs note: Crate SQL lacks BLOB in-table support | ✅ | MariaDB knex.js | impl: code/sql/knex.jsy test: test/int--mysql/integ-test.mjs note: Uses MEDIUMBLOB | ✅ | MySQL knex.js | impl: code/sql/knex.jsy test: test/int--mysql/integ-test.mjs note: Uses MEDIUMBLOB | ✅ | Microsoft SQL Server knex.js | impl: code/sql/knex.jsy test: test/int--mssql-server/integ-test.mjs
Storage Adapters
Level adapter
| | Technology / Library | Implementation |----|----------------------|---------------- | ✅ | LevelDB leveldown | impl: code/adapter/level.jsy test: test/int--level/integ-test.mjs | ✅ | memdown memdown | impl: code/adapter/level.jsy test: test/int--level/integ-test.mjs | ✅ | subleveldown sharing subleveldown | impl: code/adapter/level.jsy test: test/int--level/integ-test.mjs | ✅ | RocksDB rocksdb | impl: code/adapter/level.jsy test: test/int--level/integ-test.mjs | ✅ | Medea medeadown | impl: code/adapter/level.jsy test: test/int--level/integ-test.mjs | ✅ | Redis redisdown | impl: code/adapter/level.jsy test: test/int--redis/integ-test.mjs | ✅ | AWS S3 or compatible s3leveldown | impl: code/adapter/level.jsy test: test/int--s3api/integ-test.mjs | ✅ | SQLite level and | impl: code/adapter/level.jsy test: test/int--sqlite3/integ-test.mjs
Keyv adapter
| | Technology / Library | Implementation
|----|----------------------|----------------
| ✅ | JavaScript Map keyv and new Map()
| impl: code/adapter/keyv.jsy test: test/unittest.node.mjs
| ⚠️ | One file keyv and keyv-file | impl: code/adapter/keyv.jsy test: test/int--fsp/integ-test.mjs Stored in a single JSON file with binary values encode in base64
| ✅ | Memcache keyv and keyv-memcache | impl: code/adapter/keyv.jsy test: test/int--memcache/integ-test.mjs
| ✅ | MongoDB keyv and @keyv/mongo | impl: code/adapter/keyv.jsy test: test/int--mongodb/integ-test.mjs
| ✅ | SQLite keyv and @keyv/sqlite | impl: code/adapter/keyv.jsy test: test/int--sqlite3/integ-test.mjs
| ❌ | PostgreSQL keyv and @keyv/postgres | impl: code/adapter/keyv.jsy test: test/int--postgres/integ-test.mjs ❌ note: Failed
| ❌ | MariaDB keyv and @keyv/mysql | impl: code/adapter/keyv.jsy test: test/int--mysql/integ-test.mjs ❌ note: Failed to store large blobs
| ❌ | MySQL keyv and @keyv/mysql | impl: code/adapter/keyv.jsy test: test/int--mysql/integ-test.mjs ❌ note: Failed to store large blobs
About PHORBAS
The PHORBAS project implements a persistent binary data storage scheme that accomodates opaque (encrypted) information. It is inspired by binary content addressable data storage, replication features of CouchDB, the opaque data storage of Tahoe-LAFS, the eventual consistency of CRDTs, and persistent Hash array mapped trie data structures.
Phorbas appears in in Greek mythology and is connected to "giving pasture" -- in this case, safe pasture to for data storage.
P - Persistent
H - Hashed
O - Opaque
R - Replicable
B - Binary key/content
A - Addressable
S - Store
Due to the opaque nature of the data storage, the storage is not queryable like a database. It is similar to IPFS with a less ambitious goal of being a pratical data storage scheme for data for embedding into other projects.