-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support delete, also fix some encoding issues and similar bugs
When we delete, we don't actually delete, we just remove it from the name tree. To enable GC or undelete, we write a record of the deleted inodes in the 'X' keyspace
- Loading branch information
Showing
15 changed files
with
740 additions
and
24 deletions.
There are no files selected for viewing
574 changes: 566 additions & 8 deletions
574
cloudata-files/src/main/java/com/cloudata/files/FilesModel.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
cloudata-files/src/main/java/com/cloudata/files/webdav/DeleteHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.cloudata.files.webdav; | ||
|
||
import io.netty.handler.codec.http.HttpObject; | ||
import io.netty.handler.codec.http.HttpResponseStatus; | ||
|
||
import com.cloudata.files.fs.FsClient; | ||
import com.cloudata.files.fs.FsPath; | ||
|
||
public class DeleteHandler extends MethodHandler { | ||
|
||
public DeleteHandler(WebdavRequestHandler requestHandler) { | ||
super(requestHandler); | ||
} | ||
|
||
@Override | ||
protected HttpObject doAction(FsPath fsPath) throws Exception { | ||
WebdavRequest request = getRequest(); | ||
FsClient fsClient = getFsClient(); | ||
|
||
int depth = request.getDepth(); | ||
|
||
if (fsPath.isFolder()) { | ||
if (depth != WebdavRequest.DEPTH_INFINITY) { | ||
throw new WebdavResponseException(HttpResponseStatus.CONFLICT); | ||
} | ||
} | ||
|
||
if (!fsClient.delete(fsPath)) { | ||
throw new WebdavResponseException(HttpResponseStatus.CONFLICT); | ||
} | ||
|
||
return buildFullResponse(HttpResponseStatus.NO_CONTENT); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters