Improve/add some comments for clarity

This commit is contained in:
Simon Detheridge 2020-03-04 16:25:11 +00:00
parent def383574e
commit a7198764cb
2 changed files with 12 additions and 5 deletions

View file

@ -78,11 +78,12 @@ async function sendStream(bucketName, key, readStream, sourceMd5) {
const meteredStream = PersistorHelper.getMeteredStream(
readStream,
'gcs.egress'
'gcs.egress' // egress from us to gcs
)
const writeOptions = {
resumable: false // recommended by Google
// disabling of resumable uploads is recommended by Google:
resumable: false
}
if (sourceMd5) {
@ -126,7 +127,10 @@ async function getFileStream(bucketName, key, opts = {}) {
.file(key)
.createReadStream(opts)
const meteredStream = PersistorHelper.getMeteredStream(stream, 'gcs.ingress')
const meteredStream = PersistorHelper.getMeteredStream(
stream,
'gcs.ingress' // ingress to us from gcs
)
try {
await PersistorHelper.waitForStreamReady(stream)

View file

@ -74,7 +74,7 @@ async function sendStream(bucketName, key, readStream, sourceMd5) {
const meteredStream = PersistorHelper.getMeteredStream(
readStream,
's3.egress'
's3.egress' // egress from us to s3
)
// if we have an md5 hash, pass this to S3 to verify the upload
@ -139,7 +139,10 @@ async function getFileStream(bucketName, key, opts) {
.getObject(params)
.createReadStream()
const meteredStream = PersistorHelper.getMeteredStream(stream, 's3.ingress')
const meteredStream = PersistorHelper.getMeteredStream(
stream,
's3.ingress' // ingress to us from s3
)
try {
await PersistorHelper.waitForStreamReady(stream)