Centralize file format version tag.
This commit is contained in:
parent
fee95b9d62
commit
95a133c7cc
3 changed files with 3 additions and 2 deletions
|
@ -27,6 +27,7 @@
|
|||
-define(TOP_LEVEL, 8).
|
||||
-define(BTREE_SIZE(Level), (1 bsl (Level))).
|
||||
-define(FIRST_BLOCK_POS, 4).
|
||||
-define(FILE_FORMAT, <<"HAN1">>).
|
||||
|
||||
-define(TOMBSTONE, 'deleted').
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ open(Name, Config) ->
|
|||
{ok, FileInfo} = file:read_file_info(Name),
|
||||
|
||||
%% read and validate magic tag
|
||||
{ok, <<"HAN1">>} = file:pread(File, 0, 4),
|
||||
{ok, ?FILE_FORMAT} = file:pread(File, 0, 4),
|
||||
|
||||
%% read root position
|
||||
{ok, <<RootPos:64/unsigned>>} = file:pread(File, FileInfo#file_info.size-8, 8),
|
||||
|
|
|
@ -94,7 +94,7 @@ init([Name,Options]) ->
|
|||
% io:format("got name: ~p~n", [Name]),
|
||||
case do_open(Name, Options, [exclusive]) of
|
||||
{ok, IdxFile} ->
|
||||
file:write(IdxFile, <<"HAN1">>),
|
||||
file:write(IdxFile, ?FILE_FORMAT),
|
||||
{ok, BloomFilter} = ebloom:new(erlang:min(Size,16#ffffffff), 0.01, 123),
|
||||
BlockSize = hanoidb:get_opt(block_size, Options, ?NODE_SIZE),
|
||||
{ok, #state{ name=Name,
|
||||
|
|
Loading…
Reference in a new issue