Github user gilv commented on a diff in the pull request:

    https://github.com/apache/couchdb-fabric/pull/33#discussion_r48724446
  
    --- Diff: src/fabric_att_handler.erl ---
    @@ -0,0 +1,136 @@
    +% Licensed under the Apache License, Version 2.0 (the "License"); you may 
not
    +% use this file except in compliance with the License. You may obtain a 
copy of
    +% the License at
    +%
    +%   http://www.apache.org/licenses/LICENSE-2.0
    +%
    +% Unless required by applicable law or agreed to in writing, software
    +% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    +% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    +% License for the specific language governing permissions and limitations 
under
    +% the License.
    +
    +-module(fabric_att_handler).
    +
    +-include_lib("fabric/include/fabric.hrl").
    +-include_lib("couch/include/couch_db.hrl").
    +
    +-export([att_store/2, att/3, container/2, att_store/5, external_store/0]).
    +
    +
    +%% ====================================================================
    +%% External API functions. Exposes a generic API that can be used with 
    +%% other backend drivers
    +%% ====================================================================
    +
    +att_store(FileName, Db, ContentLen, MimeType, Req) ->
    +    ContainerName = container_name(Db),
    +    couch_log:debug("Going to store ~p of length is ~p," 
    +                   ++ " ~p in the container: ~n",[FileName, ContentLen,
    +                                                  ContainerName]),
    +    %TO-DO: No chunk reader. All kept in the memory. Should be fixed.
    +    Data = couch_httpd:recv(Req, ContentLen),
    --- End diff --
    
    @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 here.
    
    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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to