Sha256: 31264f93dce8c96e8c9c3404de3a6bf14b23721606a035288a8efdcc5e4823fd

Contents?: true

Size: 796 Bytes

Versions: 2

Compression:

Stored size: 796 Bytes

Contents

require 'alephant/lookup/lookup_table'
require 'alephant/lookup/lookup_query'

module Alephant
  module Lookup
    class LookupHelper
      attr_reader :lookup_table

      def initialize(lookup_table)
        @lookup_table = lookup_table
        @lookup_table.create
      end

      def read(id, opts, batch_version)
        LookupQuery.new(lookup_table.table_name, id, opts, batch_version).run!
      end

      def write(id, opts, batch_version, location)
        LookupLocation.new(id, batch_version, opts, location).tap do |l|
          lookup_table.table.batch_put([
            {
              :component_key => l.component_key,
              :batch_version => l.batch_version,
              :location      => l.location
            }
          ])
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alephant-lookup-0.1.5 lib/alephant/lookup/lookup_helper.rb
alephant-lookup-0.1.4 lib/alephant/lookup/lookup_helper.rb