ssbc / ssb-friends

Manages the SSB social graph
MIT License
23 stars 6 forks source link

query API knows when relationship is encrypted #72

Closed staltz closed 3 years ago

staltz commented 3 years ago

This fixes #43

staltz commented 3 years ago

Check the storage cost of the additional privately boolean

I wanted to check what is the overhead of changing the index value from edgeValue to [edgeValue, privately] so I tried some alternatives. My @QlCTpv ~/.ssb/db2/indexes/contacts folder had

Size in bytes
edgeValue (master branch) 6 347 000
[edgeValue, privately] 9 155 062
[edgeValue, true] or [edgeValue] 8 048 349
[edgeValue, 1] or [edgeValue] 8 048 275
"a" + edgeValue or "b" + edgeValue 8 223 268
"p" + edgeValue or edgeValue 6 896 162
10 + edgeValue or edgeValue 6 896 153

The +10 number hack is the smallest but has the obvious downside of limiting the largest edge distance to 9.

My favorite compromise between small size and low-WTF-effect is "p" + edgeValue & edgeValue. Thoughts, @arj03?

arj03 commented 3 years ago

Agree, p seems like the best choice. It seems this (private/public) is actually a good case for keeping layers around. I was keen on removing it before this PR :-)

staltz commented 3 years ago

It seems this (private/public) is actually a good case for keeping layers around. I was keen on removing it before this PR :-)

Yeah! I was pleasantly surprised that it was a neat solution for this use case. :)

staltz commented 3 years ago

Hey @Powersource, feedback I'm looking from you is whether the README (the shape of the API) and tests look good.

@mixmix overall this whole PR, but I suspect you want to take a close look at contacts.js, the index for flume. While @arj03 could focus on the db2Contacts.js changes.

Powersource commented 3 years ago

other than that lgtm