Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bin/dynamo-restore-from-s3
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ program
.option('-s, --source [path]', 'Full S3 path to a JSON backup file (Required)')
.option('-t, --table [name]', 'Name of the Dynamo Table to restore to (Required)')
.option('-o, --overwrite', 'Table already exists, skip auto-create. Default is false.')
.option('-c, --concurrency <requestcount>', 'Number of concurrent requests & dynamo capacity units. Defaults to 200.')
.option('-c, --concurrency <requestcount>', 'Number of concurrent requests & dynamo capacity units. Due to default partitioning, is useless above 1000. Defaults to 500.')
.option('-pk, --partitionkey [columnname]', 'Name of Primary Partition Key. If not provided will try determine from backup.')
.option('-sk, --sortkey [columnname]', 'Name of Secondary Sort Key. Ignored unless --partitionkey is provided.')
.option('-rc, --readcapacity <units>', 'Read Units for new table (when finished). Default is 5.')
Expand Down Expand Up @@ -55,9 +55,9 @@ function translate(contentLength) {
var kb = contentLength / 1024,
mb = kb / 1024,
gb = mb / 1024;
return gb > 5 ? gb.toFixed(0) + ' Gb' :
(mb > 5 ? mb.toFixed(0) + 'Mb' :
kb.toFixed(0) + 'Kb');
return gb > 5 ? gb.toFixed(1) + ' GiB' :
(mb > 5 ? mb.toFixed(1) + 'MiB' :
kb.toFixed(0) + 'KiB');
}

// Define events
Expand All @@ -75,8 +75,8 @@ dynamoRestore.on('start-download', function(streamMeta) {
console.log('Starting download. %s remaining...', translate(streamMeta.ContentLength));
});

dynamoRestore.on('send-batch', function(batches, requests, streamMeta) {
console.log('Batch sent. %d in flight. %s remaining to download...', requests, translate(streamMeta.RemainingLength));
dynamoRestore.on('send-batch', function(batches, queue, streamMeta) {
console.log('%d batches in flight. %d items in queue. %s remaining to download...', batches, queue, translate(streamMeta.RemainingLength));
});

// Start Process
Expand All @@ -87,4 +87,4 @@ dynamoRestore.run(function() {
seconds = Math.floor((diff % 1000 * 60) / 1000);
console.log('Done! Process completed in %s minutes %s seconds.', minutes, seconds);
process.exit(0);
});
});
Loading