Sha256: 00b699ed8c48060326372b638cd87a7dbb8b5c20ed180b45ef618a60bee96406

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 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, opts, batch_version, location).tap do |l|
          lookup_table.table.batch_put([
            {
              :component_key => l.component_key,
              :batch_version => l.batch_version,
              :location      => l.location
            }
          ])
        end
      end

      def truncate!
        @lookup_table.truncate!
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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