Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: support batch updates via HTTP #100

Merged
merged 5 commits into from Mar 9, 2017
Merged

WIP: support batch updates via HTTP #100

merged 5 commits into from Mar 9, 2017

Commits on Mar 8, 2017

  1. new barrell_write_batch API

    instead of expecting a list manage the update batch as a stack on which we are happening the values in order.
    benoitc committed Mar 8, 2017
    Configuration menu
    Copy the full SHA
    178acbf View commit details
    Browse the repository at this point in the history

Commits on Mar 9, 2017

  1. support batch updates via HTTP

    now supports batch via HTTP.
    
    A batch is a JSON seent on Post with following headers and similar body:
    
    Headers :
    
    x-barrel-write-batch: true
    x-barrel-async: false
    
    JSON:
    
    { "updated":
      [
         { "op": "put", "doc": {},  "rev": "" },
         { "op": "delete", "id": "someid", "rev": "" },
         { "op": "post", "doc": {} }
      ]
    }
    
    Response is the following
    
    if Async is true:
    
    { "ok" : true }
    
    Or following response
    
    {
       "ok": true,
       "results":
          [
            {"status": "ok", "id": "docid", "rev": "revid" },
            ..
         ]
     }
    
    Results can be
    
    -  {"status": "ok", "id": "docid", "rev": "revid" }
    -  {"status": "error", "reason": "not found" }
    -  {"status": "conflict", "reason": "doc exists" }
    -  {"status": "conflict", "reason": "revision conflic" }
    benoitc committed Mar 9, 2017
    Configuration menu
    Copy the full SHA
    2813e61 View commit details
    Browse the repository at this point in the history
  2. add barrel_local:write_batch/3

    helper to write batches so the HTTP API don't rely on barrel_db. While I'm here, move the json parsing to the batch module.
    benoitc committed Mar 9, 2017
    Configuration menu
    Copy the full SHA
    64aa670 View commit details
    Browse the repository at this point in the history
  3. fix spec

    benoitc committed Mar 9, 2017
    Configuration menu
    Copy the full SHA
    91d2dcc View commit details
    Browse the repository at this point in the history
  4. expost batch api in barrel_httpc

    The batch API also supports attachments.
    benoitc committed Mar 9, 2017
    Configuration menu
    Copy the full SHA
    9ea7ee0 View commit details
    Browse the repository at this point in the history