diff --git a/main.go b/main.go index 9f5bd3ac..aac8cba9 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,7 @@ // start Starts database through RPC calls. // stop Stops database through RPC calls. // restart Restarts database through RPC calls. +// upload Uploads to cloud storage. // // Flags: // -h, --help help for dbtester @@ -40,6 +41,7 @@ import ( "github.com/coreos/dbtester/analyze" "github.com/coreos/dbtester/bench" "github.com/coreos/dbtester/control" + "github.com/coreos/dbtester/upload" "github.com/spf13/cobra" ) @@ -63,6 +65,7 @@ func init() { rootCommand.AddCommand(control.StartCommand) rootCommand.AddCommand(control.StopCommand) rootCommand.AddCommand(control.RestartCommand) + rootCommand.AddCommand(upload.Command) } func main() { diff --git a/upload/doc.go b/upload/doc.go new file mode 100644 index 00000000..dc7ea5c6 --- /dev/null +++ b/upload/doc.go @@ -0,0 +1,16 @@ +// Copyright 2016 CoreOS, 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 upload implements storage upload command. +package upload diff --git a/bench-uploader/main.go b/upload/upload.go similarity index 86% rename from bench-uploader/main.go rename to upload/upload.go index 3a0a2f2d..d26b4586 100644 --- a/bench-uploader/main.go +++ b/upload/upload.go @@ -12,15 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// bench-uploader uploads bench results to cloud storage. -package main +package upload import ( "fmt" "io/ioutil" "log" - "os" - "time" "github.com/coreos/dbtester/remotestorage" "github.com/spf13/cobra" @@ -32,7 +29,7 @@ import ( var ( Command = &cobra.Command{ - Use: "bench-uploader", + Use: "upload", Short: "Uploads to cloud storage.", RunE: CommandFunc, } @@ -61,15 +58,6 @@ func init() { Command.PersistentFlags().StringVar(&bucket, "bucket", "", "Bucket name in cloud storage.") } -func main() { - log.Printf("bench-uploader started at %s\n", time.Now().String()[:19]) - if err := Command.Execute(); err != nil { - fmt.Fprintln(os.Stdout, err) - os.Exit(1) - } - log.Printf("bench-uploader ended at %s\n", time.Now().String()[:19]) -} - func CommandFunc(cmd *cobra.Command, args []string) error { log.Println("opening key", keyPath) kbs, err := ioutil.ReadFile(keyPath)