Commits on Mar 6, 2012
  1. @dustin

    Scripting and testing bulk writes.

    Closes #1
    dustin committed Mar 5, 2012
Commits on Mar 3, 2012
  1. @dustin

    Remove pointer non-null checks before free()

    Change ced33db reported a bug that
    was fixed by adding a check to verify a pointer is not null before
    freeing.  POSIX defines free() as performing no action when passed a
    NULL pointer.
    
    It's a bug that they're inconsistent and this is inconsistent with
    what `free(p)` is designed to do.
    
    If this bug actually exists somewhere, we need a test case to
    reproduce it, but it doesn't seem to be this.
    dustin committed Mar 2, 2012
  2. @dustin

    lua: couch:changes() now properly closes around locals.

    Instead of serializing the function in and out, I store it in the
    registry under a unique name during the invocation of changes.
    
    This also allows (theoretically) for multiple concurrent changes feeds
    to be processed using coroutines.  At the very least, it's more
    correct, usable, and efficient.
    dustin committed Mar 2, 2012
  3. @dustin
Commits on Mar 2, 2012
  1. @dustin
  2. @dustin
  3. @dustin
  4. @dustin
  5. @dustin

    Added local doc tests in lua.

    dustin committed Mar 2, 2012
  6. @dustin
Commits on Mar 1, 2012
  1. @dustin

    Basic scripting of couchstore.

    Example script:
    
    local function dump_docinfo(docinfo)
       print(string.format("  ID:     %s", docinfo:id()))
       print(string.format("  dbseq:  %d", docinfo:db_seq()))
       print(string.format("  rev:    %d", docinfo:rev()))
       print(string.format("  cas:    %d", docinfo:cas()))
       print(string.format("  exp:    %d", docinfo:exp()))
       print(string.format("  flags:  %d", docinfo:flags()))
       print(string.format("  del:    %d", docinfo:deleted()))
       print(string.format("  cmeta:  %d", docinfo:content_meta()))
       print(string.format("  len:    %d", #docinfo))
    end
    
    -- Open a DB (create if it doesn't exist)
    local db = couch.open("/tmp/lua.couch", true)
    
    -- Throw 100 keys in
    for i = 0, 100, 1 do
       local k = "key" .. i
       print(string.format("Storing %s", k))
       db:save(k, "data for " .. i, 1)
    end
    db:commit()
    
    -- Save a document with meta info
    db:save("somekey", "someval", 1, 0, 8345752, 24, 10)
    db:commit()
    
    -- Grab it and show what we've got.
    local data, docinfo = db:get("somekey")
    dump_docinfo(docinfo)
    print(string.format("Data: ``%s''", data))
    
    print("---- iterating ----")
    
    -- This does a bunch of junk after digging through the DB.
    -- Considering only documents that haven't been deleted, grab values
    -- from every even numbered doc by db_seq.  Print out stuff from the
    -- rest.
    db:changes(0, function(db, di)
                     -- Note that iteration returns deleted docs (obviously).
                     if di:deleted() == 0 then
                        if di:db_seq() % 2 == 0 then
                           local data = db:get_from_docinfo(di)
                           print(string.format("%s (%d, %d, %d, %d) -> %s",
                                               di:id(), di:db_seq(), di:cas(),
                                               di:exp(), di:flags(), data))
                        else
                           print(string.format("%s (%d, %d, %d, %d) [deleting]",
                                               di:id(), di:db_seq(), di:cas(),
                                               di:exp(), di:flags()))
                           db:delete(di:id())
                        end
                     end
                  end)
    
    db:commit()
    db:close()
    dustin committed Mar 1, 2012
  2. @dustin
  3. @dustin

    Path on open should be const.

    dustin committed Mar 1, 2012
  4. @dustin

    Use normal permissions for opening files.

    744 is kind of weird.  666 is right (umask is applied).
    dustin committed Mar 1, 2012
  5. @dustin
  6. @dustin
Commits on Feb 29, 2012
  1. @apage43
Commits on Feb 24, 2012
  1. @apage43
Commits on Feb 23, 2012
  1. @jinlim
Commits on Feb 22, 2012
  1. @apage43

    Expose b-tree guts

    apage43 committed Feb 22, 2012
  2. @apage43

    more portable printf'ing

    apage43 committed Feb 22, 2012
Commits on Feb 16, 2012
  1. Fix write header position return value

    Damien Katz committed Feb 16, 2012
Commits on Feb 14, 2012
  1. @apage43

    Forgot a character :)

    apage43 committed Feb 14, 2012
  2. @apage43
  3. @apage43
Commits on Feb 13, 2012
  1. @apage43

    Display memcache (rev) metadata in dbdump.

     Also removing writetest, has not been updated, tests are in testapp now.
    apage43 committed Feb 13, 2012
  2. @apage43

    Document rev_meta

    apage43 committed Feb 13, 2012
Commits on Feb 9, 2012
  1. @apage43
  2. @apage43

    Make save_docs take a arrays of pointers

    So that library users aren't forced to have docs and infos in contiguous arrays.
    apage43 committed Feb 9, 2012
Commits on Feb 8, 2012
  1. @apage43

    Update data doc.

    apage43 committed Feb 8, 2012
  2. @apage43
  3. @apage43

    Modified file format changes

     * b-tree structures are now always compressed, doc bodies are never compressed. Compression/Decompression is now decided by convention rather than tagging the data.
    
    Also cleaned some stuff up, and added reduce value checking to the tests.
    apage43 committed Feb 7, 2012
Commits on Feb 7, 2012
  1. @apage43

    File format changes

     * Doc now only has a "data" and "id" member, "json" and "binary" are gone.
     * DocInfo now has a uint8 member "content_meta" to be used by the consumer to store flags about the doc body data.
    apage43 committed Feb 7, 2012
Commits on Feb 6, 2012
  1. @apage43
Commits on Feb 3, 2012
  1. @apage43