-
Notifications
You must be signed in to change notification settings - Fork 96
Transaction #250
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
Transaction #250
Conversation
|
Note that class level documentation needs a rework before this is merged. |
|
A dumb transactional repository implementation lives at https://github.com/ruby-rdf/rdf/tree/feature/repository-transactions I think some tests should be put in place before something with better memory efficiency happens. |
|
Looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Changeset is solid, now.
Note that #apply_changeset is a method on Mutable, so Changesets can be applied more generally than just to repositories.
Not every `Transaction` needs to keep an up-to-date `Changeset` in buffer. This change documents that and shifts tests that were in `rdf-spec` to `RDF::Transaction`s default implementation tests. Some clarification of the looseness of ACID guarantees and the minimal requirements for transaction support are added, as well.
Defines transaction rollback requirements and implements them for the base class. Adds support for passing a isolated snapshot of the repository. The default is to use an unisolated repository for query; but this supports using any Queryable as a snapshot. Further documentation for adding transaction support to a Repository using the base class.
Implements non-mutating versions of `#insert_statement`, `#delete_statement` and `#has_statement?` which can run over a `Hamster::Hash` passed in, returning the new hash. Adds a custom `#apply_changeset` for the default `Repository`, which captures the current `@data` in a separate variable, updates the snapshot inline, then replaces `@data`. Refactors the default `#insert_statement` and `#delete_statement` implementations to use the non-mutating versions.
|
I rebased this on the Hamster repository changes, implemented snapshots and atomic application of changesets, which I think completes the work. I'm getting some In the meanwhile, feedback on this and ruby-rdf/rdf-spec#44 is welcome. Again, I understand these to be a complete implementation of the desired interface and behavior. If something is missing, that should be called out ASAP to keep the 2.0 release on track. |
|
See ruby-rdf/rdf-spec#44 (comment). We should probably merge these PRs (modulo the |
Implements `Transaction#each`
For initial review. This gets changesets and transactions in a state that I think they are usable.
Before these changes, Transaction fails regularly with no method errors on nil
#changes. Instead of "talking to" a nil onchangeswe introduceChangeset#empty?and give each transaction a changeset on initialization.This also implements
Transaction#execute, pushing responsibility for transactionality down to theRepository, viaChangeset#apply.Enumerable#supports?(:transactions)is introduced; and changesets can now be applied to anyMutable.Transactionis still aRepositoryonly concept.@bendiken, @gkellogg this could use an initial review. In the meanwhile, I'm picking up work on transactionality tests & support for the default repository.