Class: SlateDb::Snapshot
- Inherits:
-
Object
- Object
- SlateDb::Snapshot
- Defined in:
- lib/slatedb/snapshot.rb
Instance Method Summary collapse
-
#get(key, durability_filter: nil, dirty: nil, cache_blocks: nil) ⇒ String?
Get a value by key from the snapshot.
-
#scan(start_key, end_key = nil, durability_filter: nil, dirty: nil, read_ahead_bytes: nil, cache_blocks: nil, max_fetch_tasks: nil) ⇒ Iterator
Scan a range of keys from the snapshot.
Instance Method Details
#get(key, durability_filter: nil, dirty: nil, cache_blocks: nil) ⇒ String?
Get a value by key from the snapshot.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/slatedb/snapshot.rb', line 13 def get(key, durability_filter: nil, dirty: nil, cache_blocks: nil) opts = {} opts[:durability_filter] = durability_filter.to_s if durability_filter opts[:dirty] = dirty unless dirty.nil? opts[:cache_blocks] = cache_blocks unless cache_blocks.nil? if opts.empty? _get(key) else (key, opts) end end |
#scan(start_key, end_key = nil, durability_filter: nil, dirty: nil, read_ahead_bytes: nil, cache_blocks: nil, max_fetch_tasks: nil) ⇒ Iterator
Scan a range of keys from the snapshot.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/slatedb/snapshot.rb', line 32 def scan(start_key, end_key = nil, durability_filter: nil, dirty: nil, read_ahead_bytes: nil, cache_blocks: nil, max_fetch_tasks: nil, &) opts = {} opts[:durability_filter] = durability_filter.to_s if durability_filter opts[:dirty] = dirty unless dirty.nil? opts[:read_ahead_bytes] = read_ahead_bytes if read_ahead_bytes opts[:cache_blocks] = cache_blocks unless cache_blocks.nil? opts[:max_fetch_tasks] = max_fetch_tasks if max_fetch_tasks iter = if opts.empty? _scan(start_key, end_key) else (start_key, end_key, opts) end if block_given? iter.each(&) else iter end end |