0.0
No commit activity in last 3 years
No release in over 3 years
Lookup a location in S3 using DynamoDB.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
>= 0
<= 3.0.8
>= 0
>= 0
>= 0

Runtime

 Project Readme

Alephant::Lookup

Lookup a location in S3 using DynamoDB.

Build Status

Gem Version

Installation

Add this line to your application's Gemfile:

gem 'alephant-lookup'

And then execute:

$ bundle

Or install it yourself as:

$ gem install alephant-lookup

Usage

require "alephant/lookup"
# => true

AWS.config.region
# => "us-east-1"

AWS.config(:region => 'eu-west-1')
# => <AWS::Core::Configuration>

AWS.config.region
# => "eu-west-1"

lookup = Alephant::Lookup.create("mark_lookup_test")
# => #<Alephant::Lookup::LookupHelper:0x1f881554
#     @lookup_table=
#      #<Alephant::Lookup::LookupTable:0x7f8dd355
#       @config={:write_units=>5, :read_units=>10},
#       @dynamo_db=<AWS::DynamoDB>,
#       @mutex=#<Mutex:0x6a3f8a94>,
#       @range_found=false,
#       @table=<AWS::DynamoDB::Table table_name:mark_lookup_test>,
#       @table_name="mark_lookup_test">>

dynamo_db = AWS::DynamoDB.new
# => <AWS::DynamoDB>

dynamo_db.tables["mark_lookup_test"].exists?
# => true

table = dynamo_db.tables["mark_lookup_test"]
# => <AWS::DynamoDB::Table table_name:mark_lookup_test>

table.status
# => :active

table.items.count
# => 0

table.items
# => <AWS::DynamoDB::ItemCollection>

table.items.put({ :component_key => "a/b", :batch_version => 1, :location => "a/c/b/1" })
# => <AWS::DynamoDB::Item table_name:mark_lookup_test hash_value:a/b range_value:0.1E1>

table.items.put({ :component_key => "d/e", :batch_version => 1, :location => "d/f/e/1" })
# => <AWS::DynamoDB::Item table_name:mark_lookup_test hash_value:d/e range_value:0.1E1>

lookup.truncate!
# => nil

component_id  = "foo"
opts          = { :key => :value }
batch_version = 1
location      = "s3-bucket/location"

lookup.write(id, opts, batch_version, location)
lookup.read(id, opts, batch_version)

Contributing

  1. Fork it ( http://github.com/BBC-News/alephant-lookup/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request