lib/dynamoid/adapter.rb in dynamoid-3.5.0 vs lib/dynamoid/adapter.rb in dynamoid-3.6.0
- old
+ new
@@ -9,10 +9,11 @@
module Dynamoid
# Adapter's value-add:
# 1) For the rest of Dynamoid, the gateway to DynamoDB.
# 2) Allows switching `config.adapter` to ease development of a new adapter.
# 3) Caches the list of tables Dynamoid knows about.
+ # @private
class Adapter
def initialize
@adapter_ = Concurrent::Atom.new(nil)
@tables_ = Concurrent::Atom.new(nil)
end
@@ -76,12 +77,12 @@
# If a range key is present, it will also interpolate that into the ids so
# that the batch get will acquire the correct record.
#
# @param [String] table the name of the table to write the object to
# @param [Array] ids to fetch, can also be a string of just one id
- # @param [Hash] options: Passed to the underlying query. The :range_key option is required whenever the table has a range key,
- # unless multiple ids are passed in.
+ # @param [Hash] options Passed to the underlying query. The :range_key option is required whenever the table has a range key,
+ # unless multiple ids are passed in.
#
# @since 0.2.0
def read(table, ids, options = {}, &blk)
if ids.respond_to?(:each)
batch_get_item({ table => ids }, options, &blk)
@@ -92,11 +93,13 @@
# Delete an item from a table.
#
# @param [String] table the name of the table to write the object to
# @param [Array] ids to delete, can also be a string of just one id
- # @param [Hash] range_key of the record to delete, can also be a string of just one range_key
+ # @param [Hash] options allowed only +range_key+ - range key or array of
+ # range keys of the record to delete, can also be
+ # a string of just one range_key, and +conditions+
#
def delete(table, ids, options = {})
range_key = options[:range_key] # array of range keys that matches the ids passed in
if ids.respond_to?(:each)
ids = if range_key.respond_to?(:each)
@@ -113,10 +116,10 @@
end
# Scans a table. Generally quite slow; try to avoid using scan if at all possible.
#
# @param [String] table the name of the table to write the object to
- # @param [Hash] scan_hash a hash of attributes: matching records will be returned by the scan
+ # @param [Hash] query a hash of attributes: matching records will be returned by the scan
#
# @since 0.2.0
def scan(table, query = {}, opts = {})
benchmark('Scan', table, query) { adapter.scan(table, query, opts) }
end