anchor.diff:      ErrorGeneral :: atom(),
       ErrorDetail :: term().
   %% ====================================================================
  -truncate({uuid, Uuid}, Size) -> % todo alow only FullFilePath for performance reasons
  -    case logical_files_manager:get_file_full_name_by_uuid(Uuid) of
  +truncate({uuid, Uuid}, Size) ->
  +    case get_file_path_from_cache({uuid, Uuid}) of
           {ok, FullFilePath} -> truncate(FullFilePath, Size);
           Error -> Error
       end;
  -truncate(File, Size) ->
  -    {Response, Response2} = getfilelocation(File),
  -    case Response of
  -        ok ->
  -            {Storage_helper_info, FileId} = Response2,
  +truncate(FilePath, Size) ->
  +    case getfilelocation(FilePath) of
  +        {ok, {Storage_helper_info, FileId}} ->
               Res = storage_files_manager:truncate(Storage_helper_info, FileId, Size),
               case {Res, event_production_enabled("truncate_event")} of
                   {ok, true} ->
  -                    Ctx = fslogic_context:get_user_context(),
  -                    spawn(fun() ->
  -                        fslogic_context:set_user_context(Ctx),
  -                        {ok, FullFileName} = fslogic_path:get_full_file_name(File), %todo cache somehow
  -                        TruncateEvent = [{"type", "truncate_event"}, {"user_dn", fslogic_context:get_user_dn()}, {"filePath", File}, {"filePath", FullFileName}],
  -                        gen_server:call(?Dispatcher_Name, {cluster_rengine, 1, {event_arrived, TruncateEvent}}),
  -                        TruncateEventAvailableBlocks = [{"type", "truncate_for_available_blocks"}, {"user_dn", fslogic_context:get_user_dn()}, {"filePath", File},
  -                            {"blocks", [{0, Size}]}, {"filePath", FullFileName}],
  -                        gen_server:call(?Dispatcher_Name, {cluster_rengine, 1, {event_arrived, TruncateEventAvailableBlocks}})
  -                    end);
  +                    {ok, FullFileName} = get_file_path_from_cache(FilePath),
  +                    TruncateEvent = [{"type", "truncate_event"}, {"user_dn", fslogic_context:get_user_dn()}, {"filePath", FullFileName}],
  +                    gen_server:call(?Dispatcher_Name, {cluster_rengine, 1, {event_arrived, TruncateEvent}}),
  +                    TruncateEventAvailableBlocks = [{"type", "truncate_for_available_blocks"}, {"user_dn", fslogic_context:get_user_dn()}, {"filePath", FullFileName},
  +                        {"blocks", [{0, Size}]}],
  +                    gen_server:call(?Dispatcher_Name, {cluster_rengine, 1, {event_arrived, TruncateEventAvailableBlocks}});
                   _ ->
                       ok
               end,
               Res;
  -        _ -> {Response, Response2}
  +        Err -> Err
       end.
   
   %% delete/1
  
positive.code:     ErrorGeneral :: atom(),
      ErrorDetail :: term().
  %% ====================================================================
  write_from_stream({uuid, Uuid}, Buf) -> % todo alow only FullFilePath for better performance
      ct:print("write_from_stream ~p",[{uuid, Uuid}]),
      case logical_files_manager:get_file_full_name_by_uuid(Uuid) of
          {ok, FullFilePath} -> write_from_stream(FullFilePath, Buf);
          Error -> Error
      end;
  write_from_stream(File, Buf) ->
      ct:print("write_from_stream ~p",[File]),
      case write_enabled(fslogic_context:get_user_dn()) of
          true ->
              {Response, Response2} = getfilelocation(File),
              case Response of
                  ok ->
                      {Storage_helper_info, FileId} = Response2,
                      Offset = cache_size(File, byte_size(Buf)),
                      Res = storage_files_manager:write(Storage_helper_info, FileId, Offset, Buf),
                      case {is_integer(Res), event_production_enabled("write_event")} of
                          {true, true} ->
                              Ctx = fslogic_context:get_user_context(),
                              spawn(fun() ->
                                  fslogic_context:set_user_context(Ctx),
                                  {ok, FullFileName} = fslogic_path:get_full_file_name(File), %todo cache somehow
                                  WriteEvent = [{"type", "write_event"}, {"user_dn", fslogic_context:get_user_dn()},
                                      {"count", Res}, {"blocks", [{Offset, Res}]}, {"filePath", FullFileName}],
                                  gen_server:call(?Dispatcher_Name, {cluster_rengine, 1, {event_arrived, WriteEvent}}),
                                  WriteEventStats = [{"type", "write_for_stats"}, {"user_dn", fslogic_context:get_user_dn()},
                                      {"bytes", Res}, {"blocks", [{Offset, Res}]}, {"filePath", FullFileName}],
                                  gen_server:call(?Dispatcher_Name, {cluster_rengine, 1, {event_arrived, WriteEventStats}}),
                                  WriteEventAvailableBlocks = [{"type", "write_for_available_blocks"}, {"user_dn", fslogic_context:get_user_dn()},
                                      {"bytes", Res}, {"blocks", [{Offset, Res}]}, {"filePath", FullFileName}],
                                  gen_server:call(?Dispatcher_Name, {cluster_rengine, 1, {event_arrived, WriteEventAvailableBlocks}})
                              end);
                          _ ->
                              ok
                      end,
                      Res;
                  _ -> {Response, Response2}
              end;
          _ ->
              {error, quota_exceeded}
  
negative.code:                             Ctx = fslogic_context:get_user_context(),
                              spawn(fun() ->
                                  fslogic_context:set_user_context(Ctx),
                                  {ok, #fileattributes{size = FileSize}} = logical_files_manager:getfileattr(FilePath), %todo IMPORTANT: this needs optimization!!!,  but cannot be done asynchronously
                                  {ok, FullFileName} = get_file_path_from_cache(FilePath),
                                  WriteEvent = [{"type", "write_event"}, {"user_dn", fslogic_context:get_user_dn()},
                                      {"bytes", Res}, {"blocks", [{FileSize - Res, Res}]}, {"filePath", FullFileName}],
                                  gen_server:call(?Dispatcher_Name, {cluster_rengine, 1, {event_arrived, WriteEvent}}),
  