upload command

This commit is contained in:
Gyu-Ho Lee 2016-03-24 23:16:55 -07:00
parent c3be834010
commit e53809591b
3 changed files with 21 additions and 14 deletions

View File

@ -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() {

16
upload/doc.go Normal file
View File

@ -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

View File

@ -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)