bench

package
v0.0.0-...-8c40914 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2016 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StageInit    = "init"
	StageWrite   = "write"
	StageRead    = "read"
	StageClean   = "clean"
	StageDispose = "dispose"
)

Variables

This section is empty.

Functions

func CleanWorker

func CleanWorker(n int, cli *s3.S3, jobs <-chan *CleanWorkerIn, results chan<- bool)

for bucket creation

func DisposeWorker

func DisposeWorker(n int, cli *s3.S3, jobs <-chan *DisposeWorkerIn, results chan<- bool)

for bucket creation

func InitWorker

func InitWorker(n int, cli *s3.S3, jobs <-chan *InitWorkerIn, result chan<- bool)

for bucket creation

func ReadWorker

func ReadWorker(n int, cli *s3.S3, hashCheck bool, jobs <-chan *ReadWorkerIn, results chan<- bool)

func StartWorkflow

func StartWorkflow(s3service *s3.S3, works []*WorkConfig, logger *logger.Logger)

func WriteWorker

func WriteWorker(n int, cli *s3.S3, hashCheck bool, jobs <-chan *WriteWorkerIn, results chan<- bool)

Types

type CleanWorkerIn

type CleanWorkerIn struct {
	Bucket string
	Key    string
}

type CleanWorkerOut

type CleanWorkerOut struct {
	Ok   bool
	Cost time.Duration
	Key  string
	Err  string
}

func DeleteObject

func DeleteObject(cli *s3.S3, bucket, key string) *CleanWorkerOut

func (*CleanWorkerOut) String

func (out *CleanWorkerOut) String() string

type Config

type Config struct {
	Host            string `json:"host"`
	Region          string `json:"region"`
	AccessKeyId     string `json:"accessKeyId"`
	AccessKeySecret string `json:"accessKeySecret"`

	Workflow []*WorkConfig `json:"workflow"`
}

func NewConfig

func NewConfig(fpath string) (cfg *Config, err error)

type DisposeWorkerIn

type DisposeWorkerIn struct {
	Bucket string
}

type DisposeWorkerOut

type DisposeWorkerOut struct {
	Ok     bool
	Cost   time.Duration
	Bucket string
	Err    string
}

func DeleteBucket

func DeleteBucket(cli *s3.S3, bucket string) *DisposeWorkerOut

func (*DisposeWorkerOut) String

func (out *DisposeWorkerOut) String() string

type InitWorkerIn

type InitWorkerIn struct {
	Bucket string
}

type InitWorkerOut

type InitWorkerOut struct {
	Ok     bool
	Cost   time.Duration
	Bucket string
	Err    string
}

func CreateBucket

func CreateBucket(cli *s3.S3, bucket string) *InitWorkerOut

func (*InitWorkerOut) String

func (out *InitWorkerOut) String() string

type ReadWorkerIn

type ReadWorkerIn struct {
	Bucket string
	Key    string
}

type ReadWorkerOut

type ReadWorkerOut struct {
	Ok   bool
	Cost time.Duration
	Key  string
	Err  string
}

func GetObject

func GetObject(cli *s3.S3, bucket, key string, hashCheck bool) *ReadWorkerOut

func (*ReadWorkerOut) String

func (out *ReadWorkerOut) String() string

type WorkConfig

type WorkConfig struct {
	Stage        string `json:"stage"`
	Concurrent   int    `json:"concurrent"`
	File         string `json:"file"`
	Filesize     int    `json:"filesize"`
	BucketPrefix string `json:"bucketPrefix"`
	BucketStart  int    `json:"bucketStart"` // bucket name start number
	BucketEnd    int    `json:"bucketEnd"`   // bucket name end number
	ObjectPrefix string `json:"ObjectPrefix"`
	ObjectStart  int    `json:"ObjectStart"` // object name start number
	ObjectEnd    int    `json:"ObjectEnd"`   // object name end number
	HashCheck    bool   `json:"hashCheck"`   // only for write|read work stage
	Enabled      bool   `json:"enabled"`     // does this work enabled?
}

func (*WorkConfig) BucketNumber

func (wc *WorkConfig) BucketNumber() int

func (*WorkConfig) ObjectNumber

func (wc *WorkConfig) ObjectNumber() int

func (*WorkConfig) ObjectTotals

func (wc *WorkConfig) ObjectTotals() int

type WriteWorkerIn

type WriteWorkerIn struct {
	Bucket string
	Key    string
	File   string
	Size   int
}

type WriteWorkerOut

type WriteWorkerOut struct {
	Ok   bool
	Cost time.Duration
	Key  string
	Err  string
}

func PutObject

func PutObject(cli *s3.S3, bucket, key, file string, hashCheck bool) *WriteWorkerOut

func (*WriteWorkerOut) String

func (out *WriteWorkerOut) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL