concurrent_revisions.cr 0.1.0

Concurrent Revisions for Crystal

concurrent_revisions

Concurrent Revisions is a concurrency control model designed to guarantee determinacy, meaning that each forked task gets a conceptual copy of all the shared state, and state changes are integrated only when tasks are joined, at which time write-write conflicts are deterministically resolved.

Installation

Clone repository manually:

git clone https://github.com/TobiasGSmollett/concurrent_revisions.cr && cd concurrent_revisions.cr/

Or add the dependency to your shard.yml:

dependencies:
  concurrent_revisions:
    github: TobiasGSmollett/concurrent_revisions.cr

Run shards install.

Usage

The fastest way to try it is by using Crystal Playground (crystal play):

require "concurrent_revisions"

include ConcurrentRevisions

x = Versioned(Int32).new(0)
y = Versioned(Int32).new(0)

r : Revision = rfork do
  x.set(1)
  rfork { }
  x.set(y.get)
end

x.set(2)
rjoin(r)

puts "#{x.get} #{y.get}" # => 0 0

References

Contributing

  1. Fork it (https://github.com/TobiasGSmollett/concurrent_revisions/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • tobya - creator and maintainer
Repository

concurrent_revisions.cr

Owner
Statistic
  • 4
  • 0
  • 0
  • 0
  • 0
  • over 4 years ago
  • July 21, 2020
License

MIT License

Links
Synced at

Thu, 07 Nov 2024 19:35:54 GMT

Languages