Documentation ¶
Overview ¶
Package dynamodbcopy provides a simple interface for you to copy info across dynamodb tables
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomSleeper ¶
RandomSleeper will sleep for the provided time (in ms) plus an additional random factor (ranging between [0, 100[). Returns the total sleep time
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config encapsulates the values nedeed for the command
func (Config) Provisioning ¶
func (c Config) Provisioning(current Provisioning) Provisioning
Provisioning calculates a new Provisioning value based on the passed argument and the current Config (receiver). The returned Provisioning value will have the higher values for read and write capacity units of the 2
type Copier ¶
Copier is the interface that allows you to copy records from the source to target table
func NewCopier ¶
func NewCopier(srcTableService, trgTableService DynamoDBService, copierChan CopierChan, logger Logger) Copier
NewCopier returns a new Copier to copy records
type CopierChan ¶
type CopierChan struct { Items chan []DynamoDBItem Errors chan error }
CopierChan encapsulates the value and error channel used by the copier
func NewCopierChan ¶
func NewCopierChan(itemsChanSize int) CopierChan
NewCopierChan creates a new CopierChan with a buffered chan []DynamoDBItem of itemsChanSize
type DynamoDBClient ¶
type DynamoDBClient interface { dynamodbiface.DynamoDBAPI }
DynamoDBClient is a wrapper interface over aws-sdk dynamodbiface.DynamoDBClient for mocking purposes
func NewDynamoClient ¶
func NewDynamoClient(roleArn string) DynamoDBClient
NewDynamoClient creates a DynamoDB client wrapper around the AWS-SDK with a predefined Session. By default, it creates a new Session with SharedConfigEnable, so you can use AWS SDK's environment variables and AWS credentials to connect to DynamoDB.
The provided ARN role allows you to configure the Session to assume a specific IAM Role.
If an empty string is provided, it will create a new session with SharedConfigEnable Please refer to https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html for more information on how you can set up the SDK
type DynamoDBItem ¶
type DynamoDBItem map[string]*dynamodb.AttributeValue
DynamoDBItem type to abstract a DynamoDB item
type DynamoDBService ¶
type DynamoDBService interface { DescribeTable() (*dynamodb.TableDescription, error) UpdateCapacity(capacity Capacity) error WaitForReadyTable() error BatchWrite(items []DynamoDBItem) error Scan(totalSegments, segment int, itemsChan chan<- []DynamoDBItem) error }
DynamoDBService interface provides methods to call the aws sdk
func NewDynamoDBService ¶
func NewDynamoDBService(tableName string, client DynamoDBClient, sleepFn Sleeper, logger Logger) DynamoDBService
NewDynamoDBService creates new service for a given DynamoDB table with a previously configured DynamoDB client
type Logger ¶
type Logger interface {
Printf(format string, msg ...interface{})
}
Logger defines the logging interface used by the command
func NewDebugLogger ¶
NewDebugLogger creates a wrapper around the argument logger to only log when debug flag is true
type Provisioner ¶
type Provisioner interface { Fetch() (Provisioning, error) Update(provisioning Provisioning) (Provisioning, error) }
Provisioner is the interface that provides the methods to manipulate DynamoDB's provisioning values
func NewProvisioner ¶
func NewProvisioner(srcTableService, trgTableService DynamoDBService, logger Logger) Provisioner
NewProvisioner returns a new Provisioner to manipulate the source and target table provisioning values
type Provisioning ¶
Provisioning stores the provisioning capacities for the source and target tables The Capacity for each table will be nil when the table's billing mode isn't BillingModeProvisioned
func NewProvisioning ¶
func NewProvisioning(srcDescription, trgDescription *dynamodb.TableDescription) Provisioning
NewProvisioning creates a new Provisioning based on the source and target tables dynamodb.TableDescription It will only set capacity for each table if the is BillingModeProvisioned
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0
|
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 |
pkg
|
|