Skip to content

tobyapi/concurrent_revisions.cr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Concurrent Revisions for Crystal

Resources

License

Stars

Watchers

Forks

Packages

No packages published