Class: Himari::Aws::DynamodbStorage

Inherits:
Object
  • Object
show all
Includes:
Storages::Base
Defined in:
lib/himari/aws/dynamodb_storage.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client: ::Aws::DynamoDB::Client.new, table_name:, consistent_read: true) ⇒ DynamodbStorage

Returns a new instance of DynamodbStorage.

Parameters:

  • client (Aws::DynamoDB::Client) (defaults to: ::Aws::DynamoDB::Client.new)
  • table_name (String)

    name of DynamoDB table with hash=pk/range=sk key.

  • consistent_read (Boolean) (defaults to: true)

    use consitent read when querying. default to true.



14
15
16
17
18
# File 'lib/himari/aws/dynamodb_storage.rb', line 14

def initialize(client: ::Aws::DynamoDB::Client.new, table_name:, consistent_read: true)
  @client = client
  @table_name = table_name
  @consistent_read = consistent_read
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



20
21
22
# File 'lib/himari/aws/dynamodb_storage.rb', line 20

def client
  @client
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



20
21
22
# File 'lib/himari/aws/dynamodb_storage.rb', line 20

def table_name
  @table_name
end

Instance Method Details

#consistent_read?Boolean

Returns:

  • (Boolean)


22
# File 'lib/himari/aws/dynamodb_storage.rb', line 22

def consistent_read?; !!@consistent_read; end