anchor.diff:  %%       4. open writer cursor
   do_init(State) -> State.
   
  +%% @private Get value from key-value list, crash if not found.
  +-spec keyget(Key::term(), [{Key::term(), Value::term()}]) -> Value::term().
   keyget(Key, KvList) ->
     {Key, Value} = lists:keyfind(Key, 1, KvList),
     Value.
  +
  +%% @private Get value from key-value list, return default if not found
  +-spec keyget(Key::term(), [{Key::term(), Value::term()}], Default::term()) -> Value::term().
  +keyget(Key, KvList, Default) ->
  +  case lists:keyfind(Key, 1, KvList) of
  +    {Key, Value} -> Value;
  +    false        -> Default
  +  end.
   
   -spec maybe_close_index(?undef | index()) -> ok.
   maybe_close_index(?undef) -> ok;
  
positive.code:   gen_server:cast(Pid, stop).
  
  %%%*_ gen_server CALLBACKS =====================================================
  init(Options) ->
    Dir = keyget(key, Options),
    gen_server:cast(self(), post_init),
    #state{dir = Dir}.
  
  handle_cast(post_init, #state{} = State) ->
    NewState = do_init(State),
  
negative.code: -define(FIELD_ERR(RECORD_NAME, FIELD_NAME),
          erlang:error({field_value_missing, RECORD_NAME, FIELD_NAME})).
  
  -define(ST_FIELD_ERR(FIELD_NAME), ?FIELD_ERR(state, FIELD_NAME)).
  
  -record(state,
          { dir   = ?ST_FIELD_ERR(dir)   :: dirname()        %% index / segment file location
          , segMB = ?ST_FIELD_ERR(segMB) :: bytecnt()        %% segment file size limit in MB
          , index                        :: ?undef | index() %% index
          , w_cur                        :: ?undef | w_cur() %% writer causor
          }).
  
  %%%*_ API FUNCTIONS ============================================================
  
  start(Options) ->
    gen_server:start(?MODULE, Options, []).
  
  