tpcc

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2020 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MONEY_DECIMALS = 2
	// Item constants
	NUM_ITEMS  = 100000
	MIN_IM     = 1
	MAX_IM     = 10000
	MIN_PRICE  = 1.00
	MAX_PRICE  = 100.00
	MIN_I_NAME = 14
	MAX_I_NAME = 24
	MIN_I_DATA = 26
	MAX_I_DATA = 50

	//  Warehouse constants
	MIN_TAX       = 0
	MAX_TAX       = 0.2000
	TAX_DECIMALS  = 4
	INITIAL_W_YTD = 300000.00
	MIN_NAME      = 6
	MAX_NAME      = 10
	MIN_STREET    = 10
	MAX_STREET    = 20
	MIN_CITY      = 10
	MAX_CITY      = 20
	STATE         = 2
	ZIP_LENGTH    = 9
	ZIP_SUFFIX    = "11111"

	// Stock constants
	MIN_QUANTITY        = 10
	MAX_QUANTITY        = 100
	DIST                = 24
	STOCK_PER_WAREHOUSE = 100000

	//  District constants
	DISTRICTS_PER_WAREHOUSE = 10
	INITIAL_D_YTD           = 30000.00
	INITIAL_NEXT_O_ID       = 3001

	// Customer constants
	CUSTOMERS_PER_DISTRICT = 3000
	INITIAL_CREDIT_LIM     = 50000.00
	MIN_DISCOUNT           = 0.0000
	MAX_DISCOUNT           = 0.5000
	DISCOUNT_DECIMALS      = 4
	INITIAL_BALANCE        = -10.00
	INITIAL_YTD_PAYMENT    = 10.00
	INITIAL_PAYMENT_CNT    = 1
	INITIAL_DELIVERY_CNT   = 0
	MIN_FIRST              = 6
	MAX_FIRST              = 10
	MIDDLE                 = "OE"
	PHONE                  = 16
	MIN_C_DATA             = 300
	MAX_C_DATA             = 500
	GOOD_CREDIT            = "GC"
	BAD_CREDIT             = "BC"
	//  Order constants
	MIN_CARRIER_ID = 1
	MAX_CARRIER_ID = 10
	//  HACK: This is not strictly correct, but it works
	NULL_CARRIER_ID = 0
	//  O_ID < than this value, carrier != null, >= -> carrier == null
	NULL_CARRIER_LOWER_BOUND    = 2101
	MIN_OL_CNT                  = 5
	MAX_OL_CNT                  = 15
	INITIAL_ALL_LOCAL           = 1
	INITIAL_ORDERS_PER_DISTRICT = 3000

	//  Used to generate new order transactions
	MAX_OL_QUANTITY = 10

	//  Order line constants
	INITIAL_QUANTITY = 5
	MIN_AMOUNT       = 0.01

	//  History constants
	MIN_DATA       = 12
	MAX_DATA       = 24
	INITIAL_AMOUNT = 10.00

	//  New order constants
	INITIAL_NEW_ORDERS_PER_DISTRICT = 900

	//  TPC-C 2.4.3.4 (page 31) says this must be displayed when new order rolls back.
	INVALID_ITEM_MESSAGE = "Item number is not valid"

	//  Used to generate stock level transactions
	MIN_STOCK_LEVEL_THRESHOLD = 10
	MAX_STOCK_LEVEL_THRESHOLD = 20

	//  Used to generate payment transactions
	MIN_PAYMENT = 1.0
	MAX_PAYMENT = 5000.0

	//  Indicates "brand" items and stock in I_DATA and s_data.
	ORIGINAL_STRING = "ORIGINAL"

	// Table Names
	TABLENAME_ITEM       = "ITEM"
	TABLENAME_WAREHOUSE  = "WAREHOUSE"
	TABLENAME_DISTRICT   = "DISTRICT"
	TABLENAME_CUSTOMER   = "CUSTOMER"
	TABLENAME_STOCK      = "STOCK"
	TABLENAME_ORDERS     = "ORDERS"
	TABLENAME_NEW_ORDER  = "NEW_ORDER"
	TABLENAME_ORDER_LINE = "ORDER_LINE"
	TABLENAME_HISTORY    = "HISTORY"
)
View Source
const (
	StockLevelTrx = iota
	DeliveryTrx
	OrderStatusTrx
	PaymentTrx
	NewOrderTrx
)

Variables

View Source
var SYLLABES = [...]string{"BAR", "OUGHT", "ABLE", "PRI", "PRES", "ESE", "ANTI", "CALLY", "ATION", "EING"}

Functions

This section is empty.

Types

type Address

type Address struct {
	// contains filtered or unexported fields
}

type Configuration

type Configuration struct {
	URI            string
	Transactions   bool
	DBName         string
	Threads        int
	WriteConcern   int
	ReadConcern    int
	ReportInterval int
	WareHouses     int
	ScaleFactor    float64
	PercentFail    int
}

type ScaleParameters

type ScaleParameters struct {
	Items                 int
	Warehouses            int
	DistrictsPerWarehouse int
	CustomersPerDistrict  int
	NewOrdersPerDistrict  int
}

func NewScaleParameters

func NewScaleParameters(
	scaleFactor float64,
	items int,
	warehouses int,
	districtsPerWarehouse int,
	customersPerDistrict int,
	newOrdersPerDistrict int,
) (*ScaleParameters, error)

type Transaction

type Transaction struct {
	ThreadId int
	Type     TransactionType
	Failed   bool
	Time     float64
}

type TransactionType

type TransactionType int

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(ctx context.Context, configuration *Configuration, wg *sync.WaitGroup, c chan Transaction, threadId int) (*Worker, error)

func (*Worker) CreateIndexes

func (w *Worker) CreateIndexes() error

func (*Worker) DoDelivery

func (w *Worker) DoDelivery() error

func (*Worker) DoNewOrder

func (w *Worker) DoNewOrder() error

func (*Worker) DoOrderStatus

func (w *Worker) DoOrderStatus() error

func (*Worker) DoPayment

func (w *Worker) DoPayment() error

func (*Worker) DoStockLevelTrx

func (w *Worker) DoStockLevelTrx() error

func (*Worker) Execute

func (w *Worker) Execute()

func (*Worker) GenerateItem

func (w *Worker) GenerateItem(id int, isOriginalRow bool) models.Item

func (*Worker) GenerateWarehouse

func (w *Worker) GenerateWarehouse(id int) models.Warehouse

func (*Worker) LoadItems

func (w *Worker) LoadItems()

func (*Worker) LoadWarehouse

func (w *Worker) LoadWarehouse(id int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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