Start of Client.Remove for de-queue in camsync.

This commit is contained in:
Brad Fitzpatrick 2011-03-05 11:34:12 -08:00
parent cafaec5dc8
commit 4de2eb4ebd
4 changed files with 38 additions and 2 deletions

View File

@ -145,7 +145,10 @@ func doPass(sc, dc *client.Client, passNum int) (retErr os.Error) {
bytesCopied += pr.Size
}
if *flagRemoveSource {
// TODO: remove from source
if err = sc.Remove(sb.BlobRef); err != nil {
errorCount++
log.Printf("Failed to delete %s from source: %v", sb.BlobRef, err)
}
}
}

View File

@ -39,6 +39,7 @@ func handleRemove(conn http.ResponseWriter, req *http.Request, storage blobserve
}
if partition == "" {
// TODO: remove this hard-coded policy and make configurable?
conn.WriteHeader(http.StatusUnauthorized)
fmt.Fprintf(conn, "Can't remove blobs from the default partition.\n")
return

View File

@ -8,7 +8,8 @@ GOFILES=\
config.go\
enumerate.go\
get.go\
upload.go\
remove.go\
sync.go\
upload.go\
include $(GOROOT)/src/Make.pkg

31
lib/go/client/remove.go Normal file
View File

@ -0,0 +1,31 @@
/*
Copyright 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package client
import (
"camli/blobref"
"fmt"
// "http"
"os"
)
// Remove removes the blob. An error is returned if the blob was failed to
// be removed. Removal of a non-existent blob isn't an error.
func (c *Client) Remove(b *blobref.BlobRef) os.Error {
url := fmt.Sprintf("%s/camli/post", c.server)
return os.NewError(fmt.Sprintf("NOT IMPLEMENTED remove of %s to %s", b, url))
}