replace ppppp-record with ppppp-dict

This commit is contained in:
Andre Staltz 2023-10-26 13:30:41 +03:00
parent a85403dd34
commit 9a50b8081c
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
3 changed files with 15 additions and 15 deletions

View File

@ -33,9 +33,9 @@
"c8": "7", "c8": "7",
"ppppp-caps": "github:staltz/ppppp-caps", "ppppp-caps": "github:staltz/ppppp-caps",
"ppppp-db": "github:staltz/ppppp-db", "ppppp-db": "github:staltz/ppppp-db",
"ppppp-dict": "github:staltz/ppppp-dict",
"ppppp-goals": "github:staltz/ppppp-goals", "ppppp-goals": "github:staltz/ppppp-goals",
"ppppp-keypair": "github:staltz/ppppp-keypair", "ppppp-keypair": "github:staltz/ppppp-keypair",
"ppppp-record": "github:staltz/ppppp-record",
"prettier": "^2.6.2", "prettier": "^2.6.2",
"pretty-quick": "^3.1.3", "pretty-quick": "^3.1.3",
"rimraf": "^4.4.0", "rimraf": "^4.4.0",

View File

@ -22,11 +22,11 @@ function isPresent(msg) {
return !!msg.data.update return !!msg.data.update
} }
test('record ghosts', async (t) => { test('Dict ghosts', async (t) => {
const alice = createPeer({ const alice = createPeer({
name: 'alice', name: 'alice',
gc: { maxLogBytes: 100 * 1024 * 1024 }, gc: { maxLogBytes: 100 * 1024 * 1024 },
record: { ghostSpan: 2 }, dict: { ghostSpan: 2 },
}) })
await alice.db.loaded() await alice.db.loaded()
@ -37,14 +37,14 @@ test('record ghosts', async (t) => {
_nonce: 'alice', _nonce: 'alice',
}) })
// Alice constructs a record // Alice constructs adict
await p(alice.record.load)(aliceID) await p(alice.dict.load)(aliceID)
await p(alice.record.update)('profile', { name: 'alice' }) await p(alice.dict.update)('profile', { name: 'alice' })
await p(alice.record.update)('profile', { age: 24 }) await p(alice.dict.update)('profile', { age: 24 })
await p(alice.record.update)('profile', { name: 'Alice' }) await p(alice.dict.update)('profile', { name: 'Alice' })
await p(alice.record.update)('profile', { age: 25 }) await p(alice.dict.update)('profile', { age: 25 })
await p(alice.record.update)('profile', { name: 'ALICE' }) await p(alice.dict.update)('profile', { name: 'ALICE' })
const recordID = alice.record.getFeedID('profile') const dictID = alice.dict.getFeedID('profile')
let mootID let mootID
let msgID1 let msgID1
@ -65,7 +65,7 @@ test('record ghosts', async (t) => {
assert.deepEqual( assert.deepEqual(
getFields([...alice.db.msgs()]), getFields([...alice.db.msgs()]),
['alice', 24, 'Alice', 25, 'ALICE'], ['alice', 24, 'Alice', 25, 'ALICE'],
'has all record msgs' 'has all dict msgs'
) )
assert.ok(isErased(alice.db.get(mootID)), 'moot by def erased') assert.ok(isErased(alice.db.get(mootID)), 'moot by def erased')
assert.ok(isPresent(alice.db.get(msgID1)), 'msg1 exists') assert.ok(isPresent(alice.db.get(msgID1)), 'msg1 exists')
@ -76,7 +76,7 @@ test('record ghosts', async (t) => {
// Perform garbage collection // Perform garbage collection
alice.goals.set(aliceID, 'all') alice.goals.set(aliceID, 'all')
alice.goals.set(recordID, 'record') alice.goals.set(dictID, 'dict')
await p(alice.gc.forceImmediately)() await p(alice.gc.forceImmediately)()
// Assert situation after GC // Assert situation after GC
@ -93,7 +93,7 @@ test('record ghosts', async (t) => {
assert.ok(isPresent(alice.db.get(msgID4)), 'msg4 exists') assert.ok(isPresent(alice.db.get(msgID4)), 'msg4 exists')
assert.ok(isPresent(alice.db.get(msgID5)), 'msg5 exists') assert.ok(isPresent(alice.db.get(msgID5)), 'msg5 exists')
assert.deepEqual(alice.db.ghosts.get(recordID), [msgID2]) assert.deepEqual(alice.db.ghosts.get(dictID), [msgID2])
await p(alice.close)(true) await p(alice.close)(true)
}) })

View File

@ -18,7 +18,7 @@ function createPeer(opts) {
.use(require('secret-stack/plugins/net')) .use(require('secret-stack/plugins/net'))
.use(require('secret-handshake-ext/secret-stack')) .use(require('secret-handshake-ext/secret-stack'))
.use(require('ppppp-db')) .use(require('ppppp-db'))
.use(require('ppppp-record')) .use(require('ppppp-dict'))
.use(require('ppppp-goals')) .use(require('ppppp-goals'))
.use(require('ssb-box')) .use(require('ssb-box'))
.use(require('../lib')) .use(require('../lib'))