diff options
Diffstat (limited to 'go/operation/delete_content.go')
| -rw-r--r-- | go/operation/delete_content.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/go/operation/delete_content.go b/go/operation/delete_content.go index 12f3ca4e8..8f8ea58f3 100644 --- a/go/operation/delete_content.go +++ b/go/operation/delete_content.go @@ -2,9 +2,24 @@ package operation import ( "code.google.com/p/weed-fs/go/glog" + "code.google.com/p/weed-fs/go/storage" "net/http" ) +func DeleteFile(server string, fileId string) (error) { + fid, parseErr := storage.ParseFileId(fileId) + if parseErr != nil { + return parseErr + } + lookup, lookupError := Lookup(server,fid.VolumeId) + if lookupError != nil { + return lookupError + } + if len(lookup.Locations) == 0 { + return nil + } + return Delete("http://"+lookup.Locations[0].PublicUrl+"/"+fileId) +} func Delete(url string) error { req, err := http.NewRequest("DELETE", url, nil) if err != nil { |
