-
Notifications
You must be signed in to change notification settings - Fork 92
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
Implement Transaction#mutated?
#310
Conversation
Do we have a way to silence |
Note the caveats about false positives. I considered the possibility of using This seems viable, but I opted for the simpler approach as a starting place. |
729d251
to
7a6ae88
Compare
I think you got it right. Don't know about silencing depend nicest, but it's intended to make our lives easier, not harder. See what you can figure out. |
What do you think about just dropping the I let |
Dropping warble should be fine, it seems to be more of a pain than it's worth. WRT rdf-isomorphic, probably because no recent releases, although there was a commit in July. |
7a6ae88
to
fe1a3f8
Compare
Changes Unknown when pulling fe1a3f8 on feature/tx-mutated into * on develop*. |
`#mutated?` must return `true` when the transaction would change the repository if executed against it's state at transaction start time. We allow implementations to return `true` in other cases, as well; there is no guarantee that a `false` result will be returned in any specific circumstances (or ever). For the base transaction, we simply check whether `@changes` is empty. This can give false positives, but avoids a worst-case linear check. For subclasses with no custom implementation, we raise a `NotImplementedError`. For the `SerializableTransaction` included in the default `RepositoryImplementation`, we use `#equal?` on the `Hamster::Hash` instances. This will always give a correct response for the actual implementation, moreover, it is guaranteed not to give false negatives even if a user messes with the snapshot using `#send`.
fe1a3f8
to
d94cd14
Compare
Changes Unknown when pulling d94cd14 on feature/tx-mutated into * on develop*. |
#mutated?
must returntrue
when the transaction would change therepository if executed against it's state at transaction start time.
We allow implementations to return
true
in other cases, as well; thereis no guarantee that a
false
result will be returned in any specificcircumstances (or ever).
For the base transaction, we simply check whether
@changes
isempty. This can give false positives, but avoids a worst-case linear
check.
For subclasses with no custom implementation, we raise a
NotImplementedError
.For the
SerializableTransaction
included in the defaultRepository::Implementation
, we use#equal?
on theHamster::Hash
instances. This will always give a correct response for the actual
implementation, moreover, it is guaranteed not to give false negatives
even if a user messes with the snapshot using
#send
.Closes #308.