Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

next_id should only query once inside the transaction #69

Merged
merged 4 commits into from
Feb 25, 2017
Merged

Conversation

atz
Copy link
Contributor

@atz atz commented Feb 24, 2017

Fixes #66

This preserves the API as it stands. Basically read and write! are for "outsiders" that only know about Noid::Minter. The serialize and deserialize methods are the meat.

If it is agreeable, I might go further to make write! look like:

def write!(minter, inst = instance)
  inst.update_attributes!(
    seq: minter.seq,
    counters: JSON.generate(minter.counters),
    rand: Marshal.dump(minter.instance_variable_get(:@rand))
  )
end

Then it can replace serialize completely.

@jcoyne jcoyne merged commit 4ae7678 into master Feb 25, 2017
@jcoyne jcoyne deleted the db_lock branch February 25, 2017 01:56
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants