lib/grumlin.rb in grumlin-0.21.0 vs lib/grumlin.rb in grumlin-0.21.1
- old
+ new
@@ -96,11 +96,12 @@
end
class VertexAlreadyExistsError < AlreadyExistsError; end
class EdgeAlreadyExistsError < AlreadyExistsError; end
- class ConcurrentInsertFailedError < ServerError; end
+ class ConcurrentModificationError < ServerError; end
+ class ConcurrentInsertFailedError < ConcurrentModificationError; end
class ConcurrentVertexInsertFailedError < ConcurrentInsertFailedError; end
class ConcurrentEdgeInsertFailedError < ConcurrentInsertFailedError; end
class ServerSerializationError < ServerSideError; end
@@ -125,28 +126,27 @@
class RepositoryError < Error; end
class WrongQueryResult < RepositoryError; end
- class Config
- attr_accessor :url, :pool_size, :client_concurrency, :client_factory
-
- def initialize
- @pool_size = 10
- @client_concurrency = 5
- @client_factory = ->(url, parent) { Grumlin::Client.new(url, parent: parent) }
- end
- end
-
@pool_mutex = Mutex.new
class << self
def configure
yield config
+
+ config.validate!
end
def config
@config ||= Config.new
+ end
+
+ # returns a subset of features for currently configured backend.
+ # The features lists are hardcoded as there is no way to get them
+ # from the remote server.
+ def features
+ Features.for(config.provider) # no memoization as provider may be changed
end
def default_pool
if Thread.current.thread_variable_get(:grumlin_default_pool)
return Thread.current.thread_variable_get(:grumlin_default_pool)