Skip to content
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

add optional time to squuid constructor #95

Closed
ThomasDeutsch opened this issue Jun 27, 2015 · 5 comments
Closed

add optional time to squuid constructor #95

ThomasDeutsch opened this issue Jun 27, 2015 · 5 comments

Comments

@ThomasDeutsch
Copy link

I would love to have the option to pass a optional timestamp to the squuid constructor.

one example scenario:
I store all entities in firebase. For every entity, the key is the squuid from datascript. The value is a transit-string.
If every squuid would contain the due-date of that item ( not the creation-time ) - the backend server will be able to detect all the items with that due-date without the need to transit every value. This would be perfect for many cron-jobs.

This is my Server-DB architecture:

@tonsky
Copy link
Owner

tonsky commented Jun 27, 2015

Care to provide a PR? It should be trivial

On Sat, Jun 27, 2015 at 3:34 PM Thomas Deutsch notifications@github.com
wrote:

I would love to have the option to pass a optional timestamp to the squuid
constructor.

one example scenario:
I store all entities in firebase. For every entity, the key is the squuid
from datascript. The value is a transit-string.
If every squuid will contain the due-date of that item ( not the
creation-time ) - the backend server will be able to detect all the items
with that due-date without the need to transit every value. This would be
perfect for many cron-jobs.


Reply to this email directly or view it on GitHub
#95.

@ThomasDeutsch
Copy link
Author

pull request

I think this is not correct - damn, sorry. I am working on a new pull request.

@ThomasDeutsch
Copy link
Author

#97

tonsky added a commit that referenced this issue Jul 19, 2015
@tonsky
Copy link
Owner

tonsky commented Jul 19, 2015

Decided to go with my own patch — yours has a bug, it was faster to fix it by myself: f2f05fa

Note that only seconds, not milliseconds, go to squuid (so they fit into 32 bit). Also note that the purpose of squuid was to provide monotonic unique decentralized identities. The fact that they’re using time is just a coincidence. It would be reasonable not to rely on that, and store timestamp explicitly. I’m adding sqquid/1 mostly for the symmetry of the API.

@ThomasDeutsch
Copy link
Author

Thank you very mutch. Sorry about not getting it right.

2015-07-19 15:03 GMT+02:00 Nikita Prokopov notifications@github.com:

Decided to go with my own patch — yours has a bug, it was faster to fix it
by myself: f2f05fa
f2f05fa

Note that only seconds, not milliseconds, go to squuid (so they fit into
32 bit). Also note that the purpose of squuid was to provide monotonic
unique decentralized identities. The fact that they’re using time is just a
coincidence. It would be reasonable not to rely on that, and store
timestamp explicitly. I’m adding sqquid/1 mostly for the symmetry of the
API.


Reply to this email directly or view it on GitHub
#95 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants