diff --git a/lib/go/camli/blobserver/localdisk/localdisk.go b/lib/go/camli/blobserver/localdisk/localdisk.go index ff9c410e4..b55cd9d18 100644 --- a/lib/go/camli/blobserver/localdisk/localdisk.go +++ b/lib/go/camli/blobserver/localdisk/localdisk.go @@ -27,7 +27,6 @@ import ( type diskStorage struct { *blobserver.SimpleBlobHubPartitionMap root string - } func New(root string) (storage blobserver.Storage, err os.Error) { diff --git a/lib/go/camli/blobserver/s3/s3.go b/lib/go/camli/blobserver/s3/s3.go index 4e436d6d5..b9482465a 100644 --- a/lib/go/camli/blobserver/s3/s3.go +++ b/lib/go/camli/blobserver/s3/s3.go @@ -32,3 +32,12 @@ func New(bucketPrefixURL, accessKey, secretAccessKey string) (storage blobserver &blobserver.NoImplStorage{}, }, nil } + +func newFromConfig(config map[string]interface{}) (storage blobserver.Storage, err os.Error) { + // TODO: implement + return nil, os.NewError("not implemented") +} + +func init() { + blobserver.RegisterStorageConstructor("filesystem", blobserver.StorageConstructor(newFromConfig)) +} diff --git a/server/go/camlistored/camlistored.go b/server/go/camlistored/camlistored.go index 72ea24740..b9e9f369f 100644 --- a/server/go/camlistored/camlistored.go +++ b/server/go/camlistored/camlistored.go @@ -24,6 +24,7 @@ import ( "camli/webserver" "camli/blobserver" "camli/blobserver/localdisk" + _ "camli/blobserver/s3" "camli/blobserver/handlers" "camli/mysqlindexer" // TODO: temporary for testing; wrong place kinda "camli/search" // TODO: temporary for testing; wrong place kinda @@ -232,25 +233,14 @@ func commandLineConfigurationMain() { exitFailure("No CAMLI_PASSWORD environment variable set.") } - rootPrefix := func(s string) bool { - return strings.HasPrefix(*flagStorageRoot, s) - } - - switch { - case *flagStorageRoot == "": + if *flagStorageRoot == "" { exitFailure("No storage root specified in --root") - case rootPrefix("s3:"): - // TODO: support Amazon, etc. - default: - var err os.Error - storage, err = localdisk.New(*flagStorageRoot) - if err != nil { - exitFailure("Error for --root of %q: %v", *flagStorageRoot, err) - } } - if storage == nil { - exitFailure("Unsupported storage root type %q", *flagStorageRoot) + var err os.Error + storage, err = localdisk.New(*flagStorageRoot) + if err != nil { + exitFailure("Error for --root of %q: %v", *flagStorageRoot, err) } ws := webserver.New()