Commits

Alexander Shorin  committed c657081

Fix typos

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

Comments (0)

Files changed (4)

File src/cowdb.erl

     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>

File 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

File 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

File 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) ->