COUCHDB-769: Store attachments in the external storage. #33
COUCHDB-769: Store attachments in the external storage. #33gilv wants to merge 4 commits intoapache:masterfrom
Conversation
…mplementation, supports OpenStack Swift and SoftLayer Object store
src/fabric_attachments_handler.erl
Outdated
There was a problem hiding this comment.
This option looks as boolean, but you use "external" value elsewhere in place of "true". If it pretend to be a flag, use config:get_boolean. Otherwise better pick less confusing name for default value.
There was a problem hiding this comment.
Sorry, was confused. So it's flag. Definitely use config:get_boolean and true/false atoms elsewhere.
|
Please fix:
|
src/fabric_attachments_handler.erl
Outdated
There was a problem hiding this comment.
Why you store "external" as list, no at atom, or at least as binary?
There was a problem hiding this comment.
I also think that "external" value is not the best choice. Since field is already carries external word in the key, better specify which exact external we assume here. Today it's only swift, tomorrow it could be also S3/NFS/whatever which will have to use different integration logic.
|
Would be nice to see some tests for this to prove that this all works. |
src/fabric_attachments_handler.erl
Outdated
There was a problem hiding this comment.
general note that we don't include attributions in the code.
There was a problem hiding this comment.
Oh, right. And we need ASF license header here.
|
I'm not going to have time to review this in detail, but I agree it needs tests to go in, as well as considerable cleanup. Noting here that this should not be merged before 2.0 is released whatever happens. |
|
@kxepal @rnewson
|
src/fabric_att_handler.erl
Outdated
There was a problem hiding this comment.
I think this should be in swift backend module, at least. And certainly not couch_httpd (even if these two does the same thing) - just chttpd.
There was a problem hiding this comment.
@kxepal . Thanks for review it.
fabric_at_handler is a layer between CouchDB and the backend store. It's not aware how backend store works or what it does internally. I completely agree with your other comments, for example "201" is something that belongs to the backend store and should be there.
Data = couch_httpd:recv(Req, ContentLen) is suppose to read data from the HTTP request, using the same mechanism as CouchDB works, so i use the same function to read data. Otherwise i will need to copy-paste the same code here.
Why is it different to function att_processor(DbName, Att)? That function also "aware" of CouchDB's internal functions, for example it uses couch_at module to update attachments.
There was a problem hiding this comment.
The reason why it's different is simple: couch_httpd/chttpd are frontend modules that provides HTTP API for internal stuff like couch_att.
The reason why couch_httpd better to avoid use here as that this module is for backdoor interface while chttpd that used for the front, cluster one, may eventually start work by different rules.
The reason why chttpd/couch_httpd shouldn't be here is that fabric is a layer to run cluster wide operations after http request get processed.
Also, have you checked fabric:att_receiver/2? Looks like exactly what you need here.
Initial implementation that allows CouchDB to store attachments outside of the database file.
This implementation supports OpenStack Swift and SoftLayer Object store