[ 
https://issues.apache.org/jira/browse/COUCHDB-769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15081083#comment-15081083
 ] 

ASF GitHub Bot commented on COUCHDB-769:
----------------------------------------

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

    https://github.com/apache/couchdb-fabric/pull/33#discussion_r48725942
  
    --- 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 --
    
    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.


> Store large attachments external to the .couch file
> ---------------------------------------------------
>
>                 Key: COUCHDB-769
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-769
>             Project: CouchDB
>          Issue Type: New Feature
>          Components: Database Core
>            Reporter: Robert Newson
>            Assignee: Adam Kocoloski
>         Attachments: external_attachments_alpha.patch
>
>
> For attachment-heavy applications storing the attachments in separate files 
> significantly eases compaction problems.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to