Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDBCreator ¶
RegisterDBCreator registers a creator for the database
func RegisterWorkloadCreator ¶
func RegisterWorkloadCreator(name string, creator WorkloadCreator)
RegisterWorkloadCreator registers a creator for the workload
Types ¶
type AnalyzeDB ¶
type AnalyzeDB interface {
// Analyze performs a key distribution analysis for the table.
// table: The name of the table.
Analyze(ctx context.Context, table string) error
}
AnalyzeDB is the interface for the DB that can perform an analysis on given table.
type BatchDB ¶
type BatchDB interface {
// BatchInsert inserts batch records in the database.
// table: The name of the table.
// keys: The keys of batch records.
// values: The values of batch records.
BatchInsert(ctx context.Context, table string, keys []string, values []map[string][]byte) error
// BatchRead reads records from the database.
// table: The name of the table.
// keys: The keys of records to read.
// fields: The list of fields to read, nil|empty for reading all.
BatchRead(ctx context.Context, table string, keys []string, fields []string) ([]map[string][]byte, error)
// BatchUpdate updates records in the database.
// table: The name of table.
// keys: The keys of records to update.
// values: The values of records to update.
BatchUpdate(ctx context.Context, table string, keys []string, values []map[string][]byte) error
// BatchDelete deletes records from the database.
// table: The name of the table.
// keys: The keys of the records to delete.
BatchDelete(ctx context.Context, table string, keys []string) error
}
type DB ¶
type DB interface {
// Close closes the database layer.
Close() error
// InitThread initializes the state associated to the goroutine worker.
// The Returned context will be passed to the following usage.
InitThread(ctx context.Context, threadID int, threadCount int) context.Context
// CleanupThread cleans up the state when the worker finished.
CleanupThread(ctx context.Context)
// Read reads a record from the database and returns a map of each field/value pair.
// table: The name of the table.
// key: The record key of the record to read.
// fields: The list of fields to read, nil|empty for reading all.
Read(ctx context.Context, table string, key string, fields []string) (map[string][]byte, error)
// Scan scans records from the database.
// table: The name of the table.
// startKey: The first record key to read.
// count: The number of records to read.
// fields: The list of fields to read, nil|empty for reading all.
Scan(ctx context.Context, table string, startKey string, count int, fields []string) ([]map[string][]byte, error)
// Update updates a record in the database. Any field/value pairs will be written into the
// database or overwritten the existing values with the same field name.
// table: The name of the table.
// key: The record key of the record to update.
// values: A map of field/value pairs to update in the record.
Update(ctx context.Context, table string, key string, values map[string][]byte) error
// Insert inserts a record in the database. Any field/value pairs will be written into the
// database.
// table: The name of the table.
// key: The record key of the record to insert.
// values: A map of field/value pairs to insert in the record.
Insert(ctx context.Context, table string, key string, values map[string][]byte) error
// Delete deletes a record from the database.
// table: The name of the table.
// key: The record key of the record to delete.
Delete(ctx context.Context, table string, key string) error
}
DB is the layer to access the database to be benchmarked.
type DBCreator ¶
type DBCreator interface {
Create(p *properties.Properties) (DB, error)
}
DBCreator creates a database layer.
func GetDBCreator ¶
GetDBCreator gets the DBCreator for the database
type Generator ¶
type Generator interface {
// Next generates the next value in the distribution.
Next(r *rand.Rand) int64
// Last returns the previous value generated by the distribution, e.g. the
// last Next call.
// Calling Last should not advance the distribution or have any side effect.
// If Next has not been called, Last should return something reasonable.
Last() int64
}
Generator generates a sequence of values, following some distribution (Uniform, Zipfian, etc.).
type Measurer ¶
type Measurer interface {
// Measure measures the latency of an operation.
Measure(op string, start time.Time, latency time.Duration)
// Summary writes a summary of the current measurement results to stdout.
Summary()
// GenerateExtendedOutputs is called at the end of the benchmark
GenerateExtendedOutputs()
// Output writes the measurement results to the specified writer.
Output(w io.Writer) error
}
Measurer is used to capture measurements.
type Workload ¶
type Workload interface {
// Close closes the workload.
Close() error
// InitThread initializes the state associated to the goroutine worker.
// The Returned context will be passed to the following DoInsert and DoTransaction.
InitThread(ctx context.Context, threadID int, threadCount int) context.Context
// CleanupThread cleans up the state when the worker finished.
CleanupThread(ctx context.Context)
// Load data into DB.
Load(ctx context.Context, db DB, totalCount int64) error
// DoInsert does one insert operation.
DoInsert(ctx context.Context, db DB) error
// DoBatchInsert does batch insert.
DoBatchInsert(ctx context.Context, batchSize int, db DB) error
// DoTransaction does one transaction operation.
DoTransaction(ctx context.Context, db DB) error
// DoBatchTransaction does the batch transaction operation.
DoBatchTransaction(ctx context.Context, batchSize int, db DB) error
}
Workload defines different workload for YCSB.
type WorkloadCreator ¶
type WorkloadCreator interface {
Create(p *properties.Properties) (Workload, error)
}
WorkloadCreator creates a Workload
func GetWorkloadCreator ¶
func GetWorkloadCreator(name string) WorkloadCreator
GetWorkloadCreator gets the WorkloadCreator for the database
Click to show internal directories.
Click to hide internal directories.