An open API service indexing awesome lists of open source software.

https://github.com/bluefeet/starch-store-paws-dynamodb

Starch storage backend using Paws::DynamoDB.
https://github.com/bluefeet/starch-store-paws-dynamodb

in-development perl5

Last synced: 14 days ago
JSON representation

Starch storage backend using Paws::DynamoDB.

Awesome Lists containing this project

README

          

=pod

=head1 NAME

Starch::Store::Paws::DynamoDB - Starch storage backend using Paws::DynamoDB.

=head1 SYNOPSIS

my $starch = Starch->new(
store => {
class => '::Paws::DynamoDB',
region => 'us-west-2',
},
);

=head1 DESCRIPTION

This L store uses L to set and get state data.

This module is meant to be a more robust replacement for
L for several reasons:

=over

=item *

L lacks many features and it does not appear like
this will change any time soon.

=item *

L appears to be the king of AWS API in Perl, likely deprecating
many of the existing AWS modules on CPAN.

=back

=head1 WARNING

L is not yet stable as it is being actively developed and no promises
are being made in regards to API stability or quality of the software.

Thus, this module also does not make any such promises. Once Paws reaches
version 1 this will change.

=head1 SERIALIZATION

Unlike L this module does not jump through
a bunch of hoops to serialize only complex data structures, nor does it give
you the ability to choose a serializer.

Instead all data is serialized with L. This makes things a
lot simpler for tools written in other languages, or even just for humans
looking at the raw records in DynamoDB. It also simplifies the code.

=head1 OPTIMIZATION

You should probably run the following code as early as possible:

use Paws;
Paws->default_config->immutable(1);

This will ensure that you get the most run-time performance, but with
a small compile-time slow down. See more at L.

This module automatically preloads the C, C, and
C methods of the L class.

=head1 OPTIONAL ARGUMENTS

=head2 region

This is the AWS region which will be used when building the L
object. If you specify your own L object (or aguments) then
this will be ignored. Defaults to C.

=head2 ddb

This must be set to either hash ref arguments for L
or a pre-built object (often retrieved using a method proxy).

When configuring Starch from static configuration files using a
L
is a good way to link your existing L object
constructor in with Starch so that starch doesn't build its own.

=head2 paws

The L object, which will be used to construct the L object.

If this is sepecified as a HashRef then a new L object will be
created with the HashRef used as the C argumet.

See more at L.

=head2 consistent_read

When C this sets the C flag when calling
L on the L. Defaults to C.

=head2 table

The DynamoDB table name where states are stored. Defaults to C.

=head2 key_field

The field in the L where the state ID is stored.
Defaults to C<__STARCH_KEY__>.

=head2 expiration_field

The field in the L which will hold the epoch
time when the state should be expired. Defaults to C<__STARCH_EXPIRATION__>.

=head2 connect_on_create

By default when this store is first created it will issue an L.
This initializes all the LWP and other code so that, in a forked
environment (such as a web server) this initialization only happens
once, not on every child's first request.

Defaults to C<1> (true). Set this to false if you don't want this feature.

=head1 METHODS

=head2 create_table_args

Returns the appropriate arguments to use for calling C
on the L object. By default it will look like this:

{
TableName => 'starch_states',
ProvisionedThroughput => {
ReadCapacityUnits => 1,
WriteCapacityUnits => 1,
},
AttributeDefinitions => [{
AttributeName => $key_field,
AttributeType => 'S',
}],
KeySchema => [{
AttributeName => $key_field,
KeyType => 'HASH',
}],
}

Any arguments you pass will override those in the returned arguments,
which means you could, for example, do something like this to override
the provisioned units:

my $args = $store->create_table_args(
ProvisionedThroughput => {
ReadCapacityUnits => 100,
WriteCapacityUnits => 20,
},
);

=head2 create_table

Creates the L by passing any arguments to L
and calling the C method on the L object.

This method will not return until the new table is in an C state.

If no exceptions are thrown a L object
is returned.

=head2 set

Set L.

=head2 get

Set L.

=head2 remove

Set L.

=head1 SUPPORT

Please submit bugs and feature requests to the
Starch-Store-Paws-DynamoDB GitHub issue tracker:

L

=head1 AUTHOR

Aran Clary Deltac gmail.com>

=head1 ACKNOWLEDGEMENTS

Thanks to L
for encouraging their employees to contribute back to the open
source ecosystem. Without their dedication to quality software
development this distribution would not exist.

=head1 LICENSE

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut