-
Notifications
You must be signed in to change notification settings - Fork 151
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
Support Rethinkdb? #204
Comments
This discussion seems relevant: rethinkdb/rethinkdb#4630 |
I'd be happy to accept a PR if someone wants to own it on an on-going basis. |
What about this as a starting point? (the important funcs are require 'eventmachine'
require 'fiber'
require 'rethinkdb'
$r = RethinkDB::RQL.new
$conn = $r.connect()
def get_array predicate
ret = []
docs_with_count(predicate) do |count, row|
ret << row
yield ret if ret.length == count
end
end
def docs_with_count predicate
predicate.count().em_run($conn) do |count|
predicate.em_run($conn) do |doc|
yield count, doc
end
end
end
def rsync pred
aux = Fiber.new do |current|
pred.em_run($conn) do |doc|
current.transfer doc
end
end
aux.transfer Fiber.current
end
def rmsync pred
aux = Fiber.new do |current|
get_array(pred){|docs| current.transfer docs}
end
aux.transfer Fiber.current
end
fib = Fiber.new do
doc = rsync $r.table('aux').get('94fcf756-ae81-4eb6-a50e-4004717c948a')
print doc
puts
docs = rmsync $r.table('aux')
print docs
puts
EM.stop
end
EM.run do
fib.resume
end Sorry if the code is not clear enough |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was wondering if there are plans to support Rethinkdb.
Thanks for the good job!
The text was updated successfully, but these errors were encountered: