![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Ruby gem to connect to a CouchDB database in Ruby, focusing on bulk requests. Make sure to watch Tim Anglade's excellent talk CouchDB & Ruby: You're Doing It Wrong.
Add this line to your application's Gemfile:
gem 'couch-db'
And then execute:
$ bundle
Or install it yourself as:
$ gem install couch-db
require 'couch'
# Subclass Couch::Server for application-specific logic
class MyCouch < Couch::Server
DB_NAME = 'my-db'
def initialize
super(
'https://user.couchprovider.com/', # The library automatically detects whether to use SSL
{
name: 'user',
password: 'supersecretpassword' # May be nil for public databases
max_array_length: 50, # Number of documents queued before an automatic write to the database occurs. Defaults to 250.
flush_size_mb: 15, # Size of documents queued before an automatic write to the database occurs. Defaults to 10.
open_timeout: 5*60, # HTTP timeout for opening connections, defaults to 5*30
read_timeout: 5*60, # HTTP timeout for opening connections, defaults to 5*30
}
)
@queue = []
end
def add_to_queue(doc)
@queue << doc
flushed = post_bulk_if_big_enough(DB_NAME, @queue)
puts "Added #{doc[:_id]} to queue. Flushed: #{flushed}"
end
def flush_queue
length = @queue.length
post_bulk_throttled(DB_NAME, @queue) do |res|
puts "Flushed bulk, response code #{res.code}"
end
length
end
end
#####################
# Script starts here
#####################
# Initialize couch interface
couch = MyCouch.new
couch.put("/#{MyCouch::DB_NAME}", '') # Create database
# Add some documents to our database, triggering a bulk post after every 3 docs
couch.options[:max_array_length] = 3
(1..11).each do |i|
couch.add_to_queue({_id: "document-#{i}"})
end
# Get single document.
puts couch.get_doc(
MyCouch::DB_NAME,
'document-7',
{stale: 'ok'} # Pass URL parameters in a hash
)
# Flush remaining docs
l = couch.flush_queue
puts "Flushed remaining #{l} docs in queue"
# Access docs
couch.all_docs(MyCouch::DB_NAME, 4) do |slice|
puts "> Next #{slice.length} docs:"
slice.each do |doc|
puts doc
end
end
# Delete database
couch.delete("/#{MyCouch::DB_NAME}")
After checking out the repo, run bin/setup
to install dependencies. Then, run rake false
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/digitalheir/ruby-couch-db. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that couch-db demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.