Sha256: 7f64f59e44311a33184a43975be32f94bf13c70ff17c9132a28b9f80b8c178d0

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

require "aws-sdk"
require "thread"
require "timeout"

require "alephant/support/dynamodb/table"

module Alephant
  module Lookup
    class LookupTable < ::Alephant::Support::DynamoDB::Table
      attr_reader :table_name, :client

      def initialize(table_name)
        @mutex      = Mutex.new
        @client     = AWS::DynamoDB::Client::V20120810.new
        @table_name = table_name
      end

      def write(component_key, version, location)
        client.put_item({
          :table_name => table_name,
          :item => {
            'component_key' => {
              'S' => component_key.to_s
            },
            'batch_version' => {
              'N' => version.to_s
            },
            'location' => {
              'S' => location.to_s
            }
          }
        })
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alephant-lookup-0.3.0 lib/alephant/lookup/lookup_table.rb