Skip to content

Commit

Permalink
Finish 2.0.0.beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Feb 23, 2016
2 parents e767c33 + 4f2eb55 commit b525150
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
1 change: 0 additions & 1 deletion README

This file was deleted.

34 changes: 29 additions & 5 deletions lib/rdf/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ module RDF
# above those declared by the RDF data model, should advertise this fact in
# their documentation.
#
# Isolation may be supported at various levels, indicated by `#supports?`:
# - `:read_uncommitted`: inserts & deletes in an uncommitted transaction
# Isolation may be supported at various levels, indicated by
# `#isolation_level`:
# - `:read_uncommitted`: Inserts & deletes in an uncommitted transaction
# scope may be visible to other transactions (or via `#each`, etc...)
# - `:read_committed`: inserts & deletes may be visible to other
# - `:read_committed`: Inserts & deletes may be visible to other
# transactions once committed
# - `:repeatable_read`: Phantom reads may be possible
# - `:snapshot`: A transaction reads a consistent snapshot of the data.
Expand Down Expand Up @@ -509,22 +510,32 @@ def delete_from(data, statement)
##
# A transaction for the Hamster-based `RDF::Repository::Implementation`
# with full serializability.
#
#
# @todo refactor me!
# @see RDF::Transaction
class SerializedTransaction < Transaction
##
# @see Transaction#initialize
def initialize(*)
super
@base_snapshot = @snapshot
end

##
# Inserts the statement to the transaction's working snapshot.
#
# @see Transaction#insert_statement
def insert_statement(statement)
@snapshot = @snapshot.class
.new(data: @snapshot.send(:insert_to,
@snapshot.send(:data),
process_statement(statement)))
end

##
# Deletes the statement from the transaction's working snapshot.
#
# @see Transaction#insert_statement
def delete_statement(statement)
@snapshot = @snapshot.class
.new(data: @snapshot.send(:delete_from,
Expand All @@ -537,7 +548,20 @@ def delete_statement(statement)
def isolation_level
:serializable
end


##
# Replaces repository data with the transaction's snapshot in a safely
# serializable fashion.
#
# @note this transaction uses a pessimistic merge strategy which
# fails the transaction if any data has changed in the repository
# since transaction start time. However, the specific guarantee is
# softer: multiple concurrent conflicting transactions will not
# succeed. We may choose to implement a less pessimistic merge
# strategy as a non-breaking change.
#
# @raise [TransactionError] when the transaction can't be merged.
# @see Transaction#execute
def execute
raise TransactionError, 'Cannot execute a rolled back transaction. ' \
'Open a new one instead.' if @rolledback
Expand Down
8 changes: 4 additions & 4 deletions rdf.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Gem::Specification.new do |gem|

gem.name = 'rdf'
gem.homepage = 'http://ruby-rdf.github.com/'
gem.license = 'Public Domain' if gem.respond_to?(:license=)
gem.license = 'Unlicense'
gem.summary = 'A Ruby library for working with Resource Description Framework (RDF) data.'
gem.description = 'RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data.'
gem.rubyforge_project = 'rdf'
Expand All @@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
gem.email = 'public-rdf-ruby@w3.org'

gem.platform = Gem::Platform::RUBY
gem.files = %w(AUTHORS CREDITS README UNLICENSE VERSION bin/rdf etc/doap.nt) + Dir.glob('lib/**/*.rb')
gem.files = %w(AUTHORS CREDITS README.md UNLICENSE VERSION bin/rdf etc/doap.nt) + Dir.glob('lib/**/*.rb')
gem.bindir = %q(bin)
gem.executables = %w(rdf)
gem.default_executable = gem.executables.first
Expand All @@ -30,8 +30,8 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'link_header', '~> 0.0', '>= 0.0.8'
gem.add_runtime_dependency 'hamster', '~> 2.0'
gem.add_development_dependency 'rdf-spec', '>= 2.0.0.beta', '< 3'
gem.add_development_dependency 'rdf-vocab', '>= 0.8'
gem.add_development_dependency 'rdf-xsd', '>= 1.1'
gem.add_development_dependency 'rdf-vocab', '>= 2.0.0.beta', '< 3'
gem.add_development_dependency 'rdf-xsd', '>= 2.0.0.beta', '< 3'
gem.add_development_dependency 'rest-client', '~> 1.7'
gem.add_development_dependency 'rspec', '~> 3.0'
gem.add_development_dependency 'rspec-its', '~> 1.0'
Expand Down

0 comments on commit b525150

Please sign in to comment.