diff options
Diffstat (limited to 'src/couchdb/couch_file.erl')
-rw-r--r-- | src/couchdb/couch_file.erl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl index 59074b65..fe524e24 100644 --- a/src/couchdb/couch_file.erl +++ b/src/couchdb/couch_file.erl @@ -28,6 +28,7 @@ -export([pread_binary/2, read_header/1, truncate/2, upgrade_old_header/2]). -export([append_term_md5/2,append_binary_md5/2]). -export([init/1, terminate/2, handle_call/3, handle_cast/2, code_change/3, handle_info/2]). +-export([delete/1]). %%---------------------------------------------------------------------- %% Args: Valid Options are [create] and [create,overwrite]. @@ -169,6 +170,15 @@ close(Fd) -> erlang:demonitor(MRef, [flush]) end. +delete(Filepath) -> + case file:rename(Filepath, Filepath ++ ".delete") of + ok -> + spawn(file, delete, [Filepath ++ ".delete"]), + ok; + Error -> + Error + end. + % 09 UPGRADE CODE old_pread(Fd, Pos, Len) -> {ok, <<RawBin:Len/binary>>, false} = gen_server:call(Fd, {pread, Pos, Len}, infinity), |