Commits

Benoit Chesneau committed c1e41ce Merge

Merged in kxepal/cowdb/fix-typos (pull request #4)

Fix typos

  • Participants
  • Parent commits ba4ac57, 0a75c8a
  • Branches fix-builtin-types-definition

Comments (0)

Files changed (7)

 #cowdb
 
-Cowdb implements an indexed, key/value storage engine. The primary index
-is an append-only btree implemented using CBT a btree library extracted
-from Apache CouchDB .
+CowDB implements an indexed, key/value storage engine. The primary index
+is an append-only btree which is implemented by CBT - a btree library
+extracted from Apache CouchDB .
 
-CowdDB is released under the Apache License 2.
+CowDB is released under the Apache License 2.
 
 ## Features
 
 values in a transaction. You can use them to ensure atomic
 read-modify-update processing, and integrity constraints.
 - Transaction log
-- Snapshotting support: You are able to take a snapshot of the database
+- Snapshots support: you are able to take a snapshot of the database
   at any time (until the database is compacted)
 - Destructive compaction to reclaim space in your database. The log
   history is lost during the transaction.
 
 https://wiki.refuge.io/display/COWDB/CowDB+Documentation+Home
 
-main cowdb website on http://cowdb.org
+main CowDB website is http://cowdb.org
 
 
-## build
+## Build process
 
-### 1. install rebar
-To build cowdb you need to install rebar in your `PATH`. Rebar is
+### 1. Install rebar
+To build CowDB you need to install rebar in your `PATH`. Rebar is
 available on Github:
 
 https://github.com/rebar/rebar
 [README](https://github.com/rebar/rebar/blob/master/README.md) to
 install it.
 
-### 2. build
+### 2. Build the sources
 
 Fetch the source code:
 
     $ git clone https://bitbucket.org/refugeio/cowdb.git
 
-Build the source, run the `make` command. It will fetch any needed
+Build the source, run the `make` command. It will fetch all required
 dependencies.
 
     $ cd /<PATH_TO>/cowdb
     $ make
 
 
-### 2. Build the doc
+### 3. Build the docs
 
     $ make doc
 
-and open the `index.html` file in the doc folder. Or read it
+and open the `index.html` file in the doc directory. Or read it
 [online](http://refugeio.bitbucket.org/cowdb/index.html).
 
-### 3. Run tests
+### 4. Run tests
 
     $ make test
 
     10> cowdb:fold(Pid, fun(Got, Acc) -> {ok, [Got | Acc]} end, []).
     {ok,[{d,1},{c,2},{a,1}]}
 
-## contribute
+## Contribute
 
-Open Issues and Support tickets in [Jira](https://issues.refuge.io/browse/CDB
-).
+Open Issues and Support tickets in [Jira](https://issues.refuge.io/browse/CDB).
 Code is available on [bitbucket](https://bitbucket.org/refugeio/cowdb).

doc/overview.edoc

-title cowdb - copy-on-write object database
+title CowDB - copy-on-write object database
 @author Benoit Chesneau <benoitc@refuge.io>
   [http://refuge.io/]
 @copyright 2014 Benoit Chesneau (Apache 2 License)
 @version 0.3.0
-@title cowdb - Pure Key/Value datbase for Erlang Applications
+@title CowDB - Pure Key/Value database for Erlang Applications
 
-@doc cowdb is a Key/Value database for Erlang Applications written in
+@doc CowDB is a Key/Value database for Erlang Applications written in
 full Erlang.
 
 
     gen_server:start(Name, ?MODULE, [FilePath, Options],
                      [{spawn_opts, SpawnOpts}]).
 
-%% @doc open a cowdb databas as part of the supervision treee, pass a
+%% @doc open a cowdb database as part of the supervision tree, pass a
 %% function to initialise the stores and indexes.
 -spec open_link(FilePath::string()) ->
     {ok, Db::pid()}
                           [{spawn_opts, SpawnOpts}]).
 
 %% @doc open a cowdb database as part of the supervision tree with a
-%% registerd name
+%% registered name
 - spec open_link(Name::mfa(), FilePath::string(), Option::open_options()) ->
     {ok, Db::pid()}
     | {error, term()}.
     ok = close(DbPid),
     cowdb_util:delete_file(FilePath, Async).
 
-%% @doc display database infos
+%% @doc returns database info
 -spec db_info(db()) -> {ok, list()}.
 db_info(DbPid) when is_pid(DbPid) ->
     Db = gen_server:call(DbPid, get_db, infinity),
                            cbt_btree:size(LogBt)]),
     {ok, TotalSize}.
 
-%% @doc get an object from its key
+%% @doc get an object by the specified key
 -spec get(Db::db(), Key::any()) -> {ok, any()} | {error, term()}.
 get(Db, Key) ->
     [Val] = lookup(Db, [Key]),
     Val.
 
-%% @doc get a list of object from theyir key
+%% @doc get a list of objects by the specified key
 -spec lookup(Db::db(), Keys::[any()]) -> {ok, any()} | {error, term()}.
 lookup(DbPid, Keys) when is_pid(DbPid) ->
     Db = gen_server:call(DbPid, get_db, infinity),
 %% <li>`{add, Key, Value}' to add an object</li>
 %% <li>`{remove, Key}' to remove a value</li>
 %%<li> `{fn, Func}' a transaction function. A transaction function
-%%reveived the db value like it was at the beginning of the transaction
+%%received the db value like it was at the beginning of the transaction
 %%as an argument. It's possible to pass arguments to it. A transaction
-%%function return a list of operations and can wuery/maniuplate
+%%function return a list of operations and can query/manipulate
 %%function. The list of operations returned can also contain a
 %%function.</li>
 %%</ul>

src/cowdb_compaction.erl

     delete_compact_file(Db),
     Db#db{compactor_info=nil}.
 
-%% do initiali compaction, copy the id btree.
+%% do initial compaction, copy the id btree.
 do_compact(#db{tid=LastTid, by_id=IdBt, reader_fd=ReaderFd},
            #db{fd=Fd, log=LogBt}=TargetDb, false) ->
     %% copy the IDs btree to the new database

src/cowdb_updater.erl

 
 
 do_open_db(FilePath, Options, DbPid) ->
-    %% set openoptions
+    %% set open options
     OpenOptions = case proplists:get_value(override, Options, false) of
         true -> [create_if_missing, override];
         false -> [create_if_missing]
             {ok, Db};
         {_, InitFunc} ->
             TransactId = Tid + 1,
-            %% initialise the database with the init function.
+            %% initialize the database with the init function.
             do_transaction(fun() ->
                         case call_init(InitFunc, Tid, TransactId, Db) of
                             {ok, Ops} ->
                     UpdaterPid ! {TransactId, {done, Resp}}
             end),
 
-    %% wait for its resilut
+    %% wait for the result
     receive
         {TransactId, {done, cancel}} ->
             rollback_transaction(Db),
             {error, timeout}
     end.
 
-%% roll back t the latest root
-%% we don't try to edit in place instead we take the
-%% latest known header and append it to the database file
+%% rollback to the latest root
+%% we don't try to edit in-place, instead we take
+%% the latest known header and append it to the database file
 rollback_transaction(#db{fd=Fd, header=Header}) ->
     ok= cbt_file:sync(Fd),
     {ok, _Pos} = cbt_file:write_header(Fd, Header),
     RemValues = [{RemKey, {RemKey, RemPointer, TransactId, Ts}}
                  || {ok, {_, {RemKey, RemPointer, _, _}}} <- Found],
 
-    %% reconstruct transactions operations for the log
-    %% this currently very inneficient and there is probably a better
+    %% reconstruct transaction operations for the log.
+    %% currently, this is very inefficient and, probably,  there is better
     %% way to do it.
     Log = lists:foldl(fun
                 ({add, _}=Entry, Acc) ->
     {ok, Db#db{by_id=IdBt2, log=LogBt2}};
 run_transaction([{add, Key, Value} | Rest], {ToAdd, ToRem}, Log, TransactId,
                 Ts, #db{fd=Fd}=Db) ->
-    %% we are storing the value directly in the file, the btrees will
+    %% we are storing the value directly in the file, the btree will
     %% only keep a reference so we don't have the value multiple time.
     {ok, Pos, Size} = cbt_file:append_term_crc32(Fd, Value),
     Value1 =  {Key, {Pos, Size}, TransactId, Ts},
 run_transaction(_, _, _, _, _, _) ->
     {error, unknown_op}.
 
-%% execute transactoin
+%% execute transaction
 do_transaction(Fun, TransactId) ->
     erlang:put(cowdb_trans, TransactId),
     try

src/cowdb_util.erl

     (A * 1000000) + B.
 
 
-%% @doc initialise the db
+%% @doc initialize the db
 init_db(Header, DbPid, Fd, ReaderFd, FilePath, Options) ->
     DefaultFSyncOptions = [before_header, after_header, on_file_open],
     FSyncOptions = cbt_util:get_opt(fsync_options, Options,
     %% maybe sync the header
     ok = maybe_sync(on_file_open, Fd, FSyncOptions),
 
-    %% extract infos from the header
+    %% extract db info from the header
     #db_header{tid=Tid,
                by_id=IdP,
                log=LogP} = Header,
 
 
-    %% initialise the btrees
+    %% initialize the btree
     Compression = cbt_util:get_opt(compression, Options, ?DEFAULT_COMPRESSION),
     DefaultLess = fun(A, B) -> A < B end,
     Less = cbt_util:get_opt(less, Options, DefaultLess),
     ok.
 
 
-%% @doc commit the transction on the disk.
+%% @doc commit the transaction on the disk.
 commit_transaction(TransactId, #db{by_id=IdBt,
                                    log=LogBt,
                                    header=OldHeader}=Db) ->

tools/basho_bench_driver_cowdb.erl

     %% Make sure bitcask is available
     case code:which(cowdb) of
         non_existing ->
-            ?FAIL_MSG("~s requires hanoidb to be available on code path.\n",
+            ?FAIL_MSG("~s requires cowdb to be available on code path.\n",
                       [?MODULE]);
         _ ->
             ok
         Error ->
             Error
     end;
-run(delete, KeyGen, ValueGen, Db) ->
-    case cowdb:delete(Db, KeyGen(), ValueGen()) of
+run(delete, KeyGen, _ValueGen, Db) ->
+    case cowdb:delete(Db, KeyGen()) of
         {ok, _} ->
             {ok, Db};
         Error ->