ycsb

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

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

Go to latest
Published: Apr 18, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDBCreator

func RegisterDBCreator(name string, creator DBCreator)

RegisterDBCreator registers a creator for the database

func RegisterWorkloadCreator

func RegisterWorkloadCreator(name string, creator WorkloadCreator)

RegisterWorkloadCreator registers a creator for the workload

Types

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.
	// fileds: 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 layber 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

func GetDBCreator(name string) DBCreator

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 Measurement

type Measurement interface {
	// Measure measures the opeartion latency.
	Measure(latency time.Duration)
	// Summary returns the summary of the measurement.
	Summary() string
}

Measurement measures the operations metrics.

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)

	// DoInsert does one insert operation.
	DoInsert(ctx context.Context, db DB) error

	// DoTransaction does one transaction operation.
	DoTransaction(ctx context.Context, 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

Jump to

Keyboard shortcuts

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