save attachments externally on AWS. Any idea how to pull to mobile device?

41 views
Skip to first unread message

dom utom

unread,
Dec 15, 2014, 4:40:51 PM12/15/14
to mobile-c...@googlegroups.com
Hi,
I´m working on a solution to store attachments from pushed documents using the changes_feed of sync gateway on AWS which seems to work. Written in go. Do you have any idea how to pull the documents with the externaly saved attachments to the mobile device?

Different approaches.

1. Get the attachment from AWS and pull it to the device. How?
2. Store the attachment regulary in the sync_gateway bucket as binary and it will work directly. All server side access/views to couchbase will be on the shadow bucket. Performance issues?
3. any other idea?

thanks a lot

Jens Alfke

unread,
Dec 15, 2014, 5:26:09 PM12/15/14
to mobile-c...@googlegroups.com
On Dec 15, 2014, at 1:40 PM, dom utom <dom...@googlemail.com> wrote:

I´m working on a solution to store attachments from pushed documents using the changes_feed of sync gateway on AWS which seems to work.

So you're copying each attachment to an S3 bucket? You can do that, but I'm not sure what the benefit will be, since the attachments will also remain in Couchbase Server and will get synced to devices via the CBL replicator. So you're looking at a lot of duplicate storage and bandwidth...

1. Get the attachment from AWS and pull it to the device. How?

Well, do a GET on the attachment URL in S3. Then store that somewhere. (You can't put it into CBL's attachment store, at least not without adding a duplicate copy of the attachment to the doc, which will then be synced back to the server, forming an infinite feedback loop…)

If you're trying to make it so attachments are stored only in S3, you'd have to ensure they never got into Sync Gateway or CBL at all. Have the client app upload the attachment to S3 and then put the resulting URL into the document instead of an attachment. Then any client that gets the document and wants the attachment can download it from S3.

—Jens
Reply all
Reply to author
Forward
0 new messages