Questions about the id generation for links

5 views
Skip to first unread message

Itay Shakury

unread,
Jun 22, 2015, 7:30:15 AM6/22/15
to bookie_b...@googlegroups.com
Hello, I have only recently discovered Bookie and I have started browsing the code, Very cool project!
I have a question:
From what I understand, links are stored in a DB where the primary key is the first 14 characters of the sha256 of the URL. (Please correct me if I'm wrong in my understanding, only starting to get around the codebase).
I am interested, how unique is that key? Why can't we save the entire hash (i don't think the extra few bytes per record will make a significant difference)?
Just to clarify - this is a pure question, not a bug\feature suggestion. 
Thanks,
Itay

Richard Harding

unread,
Jun 22, 2015, 8:13:03 AM6/22/15
to bookie_b...@googlegroups.com
Hello Itay, the bookmark primary key is the bid field in the bmarks table.
This is a unique value for every bookmark. Bookie keeps urls in their own
table and generates a hash_id field that is used to map a bookmark to a
url. In this way, we can tell how many folks have bookmarked a distinct
url, even though they each have their own bookmark recorded with their own
list of tags, description, etc.

This means that we're expecting users to collide on the hash of the sha'd
url. It's by design.


--

Rick Harding
@mitechie
http://blog.mitechie.com
https://bmark.us
Reply all
Reply to author
Forward
0 new messages