Libraryify: create lib/go/blobserver/handles; move Remove

This commit is contained in:
Brad Fitzpatrick 2011-02-03 15:56:02 -08:00
parent 850623f932
commit c027ca9d9e
5 changed files with 26 additions and 6 deletions

View File

@ -73,7 +73,11 @@ unless (@matches) {
die "No build targets patching pattern /$target/\n";
}
if (@matches > 1) {
die "Build pattern is ambiguous, matches multiple targets:\n * " . join("\n * ", @matches) . "\n";
if (scalar(grep { $_ eq $target } @matches) == 1) {
@matches = ($target);
} else {
die "Build pattern is ambiguous, matches multiple targets:\n * " . join("\n * ", @matches) . "\n";
}
}
build($matches[0]);
@ -163,6 +167,7 @@ __DATA__
- server/go/httputil
- lib/go/blobref
- lib/go/blobserver
- lib/go/blobserver/handlers
- server/go/auth
- server/go/webserver
./server/go/sigserver/Makefile
@ -210,3 +215,6 @@ __DATA__
# (no deps)
./lib/go/blobserver/Makefile
- lib/go/blobref
./lib/go/blobserver/handlers/Makefile
- server/go/httputil
- lib/go/blobserver

View File

@ -0,0 +1,11 @@
include $(GOROOT)/src/Make.inc
PREREQ=$(QUOTED_GOROOT)/pkg/$(GOOS)_$(GOARCH)/camli/blobserver.a\
$(QUOTED_GOROOT)/pkg/$(GOOS)_$(GOARCH)/camli/blobref.a\
$(QUOTED_GOROOT)/pkg/$(GOOS)_$(GOARCH)/camli/httputil.a\
TARG=camli/blobserver/handlers
GOFILES=\
remove.go\
include $(GOROOT)/src/Make.pkg

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package main
package handlers
import (
"camli/blobref"
@ -27,7 +27,7 @@ import (
const maxRemovesPerRequest = 1000
func createRemoveHandler(storage blobserver.Storage, partition string) func(http.ResponseWriter, *http.Request) {
func CreateRemoveHandler(storage blobserver.Storage, partition string) func(http.ResponseWriter, *http.Request) {
return func(conn http.ResponseWriter, req *http.Request) {
handleRemove(conn, req, storage, partition)
}

View File

@ -1,6 +1,7 @@
include $(GOROOT)/src/Make.inc
PREREQ=$(QUOTED_GOROOT)/pkg/$(GOOS)_$(GOARCH)/camli/blobserver.a
PREREQ=$(QUOTED_GOROOT)/pkg/$(GOOS)_$(GOARCH)/camli/blobserver.a\
$(QUOTED_GOROOT)/pkg/$(GOOS)_$(GOARCH)/camli/blobserver/handlers.a\
TARG=camlistored
GOFILES=\
@ -11,7 +12,6 @@ GOFILES=\
partitions.go\
preupload.go\
range.go\
remove.go\
temp_testing.go\
upload.go\
util.go\

View File

@ -9,6 +9,7 @@ import (
"camli/httputil"
"camli/webserver"
"camli/blobserver"
"camli/blobserver/handlers"
"flag"
"fmt"
"http"
@ -90,7 +91,7 @@ func handleCamli(conn http.ResponseWriter, req *http.Request) {
handler = auth.RequireAuth(handleMultiPartUpload)
case "remove":
// Currently only allows removing from a non-main partition.
handler = auth.RequireAuth(createRemoveHandler(storage, partition))
handler = auth.RequireAuth(handlers.CreateRemoveHandler(storage, partition))
// Not part of the spec:
case "testform": // debug only