-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to db2 #96
Upgrade to db2 #96
Conversation
New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: [email protected], [email protected], [email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far! I'm impressed by how much progress you've made so far
This comment was marked as outdated.
This comment was marked as outdated.
@@ -42,7 +42,8 @@ function fromMsgKey (msg, msgKey) { | |||
} | |||
|
|||
function fromGroupKey (msg, groupKey) { | |||
const { author, previous, content } = msg.value | |||
const { author, previous } = msg.value | |||
const content = (msg.meta && msg.meta.originalContent) || msg.value.content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const content = (msg.meta && msg.meta.originalContent) || msg.value.content | |
const content = msg?.meta?.originalContent || msg.value.content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've avoided ?.
to make it easier to potentially support node 12 again in the future, but maybe we've dropped the hopes for that?
keystore.poBox.add(poBoxId, { key: secret }, (err) => { | ||
if (err) return cb(err) | ||
ssb.box2.addPoBox(poBoxId, { key: secret }, (err) => { | ||
if (err) return cb(Error("Couldn't add pbox to box2 when adding pobox", { cause: err })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (err) return cb(Error("Couldn't add pbox to box2 when adding pobox", { cause: err })) | |
if (err) return cb(Error("ssb.tribes.addPoBox failed in ssb-box2", { cause: err })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or something
method/link.js
Outdated
parent && equal(seekParent, parent, { indexType: 'parent', prefix: true }), | ||
child && equal(seekChild, child, { indexType: 'child', prefix: true }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parent && equal(seekParent, parent, { indexType: 'parent', prefix: true }), | |
child && equal(seekChild, child, { indexType: 'child', prefix: true }), | |
parent && equal(seekParent, parent, { indexType: 'linkParent', prefix: true }), | |
child && equal(seekChild, child, { indexType: 'linkChild', prefix: true }), |
going for more specific index names by default - to avoid collisions with any other modules written
BTW I am new the the prefix: true
thing. It seems like this is the right choice here, did you ask any of the butt-db elders about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will change the index names.
didn't ask about prefix, i was hoping you were familiar 😁 i got the impression from the db2 or jitdb readme that prefix was good here but i wasn't 100%. what do you say @staltz ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed index names
parent && equal(seekParent, parent, { indexType: 'parent', prefix: true }), | ||
child && equal(seekChild, child, { indexType: 'child', prefix: true }), | ||
equal(seekTanglesLinkRoot, null, { indexType: 'tanglesLinkRoot', prefix: true }), | ||
equal(seekTanglesLinkPrevious, null, { indexType: 'tanglesLinkPrevious', prefix: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌶️
I think this index might be redundant, as it's very unlikely to have root: null
and previous: [a, b]
I think we could do a pull.filter
check instead of building an index for all the previous fields....? butt I'm not an index expert?
dbType('link/feed-group'), | ||
equal(seekParent, feedId, { indexType: 'parent', prefix: true }), | ||
equal(seekTanglesLinkRoot, null, { indexType: 'tanglesLinkRoot', prefix: true }), | ||
equal(seekTanglesLinkPrevious, null, { indexType: 'tanglesLinkPrevious', prefix: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dito
t.end() | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any cache on the group tangle still?
it's kinda important to stop clobbering the DB I think - we have some bulk record creation from import supported, can make 1000 messages easily in one go. Cannot re-build tangle per message!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we removed it also in tribes2, i think we said db2 is so good at caching anyway
await p(setTimeout)(500) | ||
|
||
t.true(me.status().sync.sync, 'all indexes updated') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new pattern I've been using for this sorta wait :
await p(setTimeout)(500) | |
t.true(me.status().sync.sync, 'all indexes updated') | |
while (!me.status().sync.sync) await p(setTimeout)(100) | |
t.pass('all indexes updated') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we're removing this in #105 anyway since it's db1 stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of minor things, but this was a very exciting and satisfying PR to read.
So awesome seeing this all tuned up and stream lined.
Fantastic work
listen.js
Outdated
dbLive({ old: true }), | ||
toPullStream() | ||
), | ||
ssb.db.reindexed(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing the filter from reindexed here seems to let weird stuff through
addNewAuthorListener
✔ admin = returns expected newAuthors
✔ admin = returns expected groupId
ssb-tribes/admin ⇒ ssb-tribes/newPerson
✔ admin sees newMember being added
✔ admin = returns expected groupId
1 [?]
2 [?]
3 group/add-member ─ ssb-tribes/newPerson
✔ newPerson returns expected newAuthors
/home/runner/work/ssb-tribes/ssb-tribes/index.js:150
const { poBoxId, key: poBoxKey } = m.value.content.keys.set
^
TypeError: Cannot read properties of undefined (reading 'set')
at /home/runner/work/ssb-tribes/ssb-tribes/index.js:150:61
at /home/runner/work/ssb-tribes/ssb-tribes/node_modules/pull-stream/sinks/drain.js:32:37
at /home/runner/work/ssb-tribes/ssb-tribes/node_modules/pull-stream/throughs/filter.js:17:11
at /home/runner/work/ssb-tribes/ssb-tribes/node_modules/pull-stream/throughs/filter.js:17:11
at /home/runner/work/ssb-tribes/ssb-tribes/node_modules/pull-stream/throughs/filter.js:17:11
at check (/home/runner/work/ssb-tribes/ssb-tribes/node_modules/pull-many/index.js:72:16)
at next (/home/runner/work/ssb-tribes/ssb-tribes/node_modules/pull-many/index.js:104:21)
at callback (/home/runner/work/ssb-tribes/ssb-tribes/node_modules/pull-pushable/index.js:84:5)
at Function.push (/home/runner/work/ssb-tribes/ssb-tribes/node_modules/pull-pushable/index.js:44:7)
at notify (/home/runner/work/ssb-tribes/ssb-tribes/node_modules/pull-notify/index.js:12:20)
✔ newPerson, returns expected groupId
test count(6) != plan(null)
Failed tests: There was 1 failure
✖ undefined) undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-added the removed filter 2f01a5f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made issue for followup #107
merging since approved and passing |
For #90
keystore