Sha256: d5f8962ed74818bb85196891ed71f1f278bdef1473f8a4ff7c01b1859aa1eb51

Contents?: true

Size: 877 Bytes

Versions: 1

Compression:

Stored size: 877 Bytes

Contents

require 'alephant/lookup/lookup_table'
require 'alephant/lookup/lookup_query'
require 'alephant/lookup/location_read'
require 'alephant/lookup/location_write'

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

1 entries across 1 versions & 1 rubygems

Version Path
alephant-lookup-0.1.3 lib/alephant/lookup/lookup_helper.rb