workload

package
v1.0.0-beta.122 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize

func Deserialize(raw []byte, doc any) error

func Serialize

func Serialize(doc *Document) ([]byte, error)

func SerializeDocV1

func SerializeDocV1(doc *DocumentV1) ([]byte, error)

Types

type Address

type Address struct {
	City    string `fake:"{city}"    json:"city"`
	State   string `fake:"{state}"   json:"state"`
	Country string `fake:"{country}" json:"country"`
}

type BigPayloadWorkload

type BigPayloadWorkload struct {
	Threads      int16
	Records      int64
	Database     string
	Collections  string
	Schemas      []byte
	WorkloadData *Queue
	IsBatch      bool
}

func (*BigPayloadWorkload) Check

func (w *BigPayloadWorkload) Check(client driver.Driver) (bool, error)

func (*BigPayloadWorkload) Setup

func (w *BigPayloadWorkload) Setup(client driver.Driver) error

func (*BigPayloadWorkload) Start

func (w *BigPayloadWorkload) Start(client driver.Driver) (int64, error)

func (*BigPayloadWorkload) Type

func (*BigPayloadWorkload) Type() string

type DDLWorkload

type DDLWorkload struct {
	Threads     int16
	Database    string
	Collections []string
	Schemas     [][]byte
}

func (*DDLWorkload) Check

func (w *DDLWorkload) Check(client driver.Driver) (bool, error)

func (*DDLWorkload) Setup

func (w *DDLWorkload) Setup(client driver.Driver) error

func (*DDLWorkload) Start

func (*DDLWorkload) Start(_ driver.Driver) (int64, error)

func (*DDLWorkload) Type

func (*DDLWorkload) Type() string

type Document

type Document struct {
	Id int64  `json:"id"`
	F2 string `fake:"{sentence:50}" json:"F2"`
	F3 []byte
	F4 uuid.UUID
	F5 time.Time
}

func NewDocument

func NewDocument(uniqueId int64) *Document

func (*Document) ID

func (d *Document) ID() int64

type DocumentV1

type DocumentV1 struct {
	Id        int64     `json:"id"`
	Cars      []string  `fake:"{carmaker}" fakesize:"20000"  json:"cars"`
	Food      []string  `fake:"{food}"     fakesize:"20000"  json:"food"`
	CreatedAt time.Time `fake:"{date}"     json:"created_at"`
	UpdatedAt time.Time `fake:"{date}"     json:"updated_at"`
	Nested    *Nested   `json:"nested"`
}

func NewDocumentV1

func NewDocumentV1(id int64) *DocumentV1

func (*DocumentV1) ID

func (d *DocumentV1) ID() int64

type DropCreateWriteWorkload

type DropCreateWriteWorkload struct {
	Threads     int16
	Database    string
	Collections []string
	Schemas     [][]byte
	Records     int64
}

func (*DropCreateWriteWorkload) Check

func (*DropCreateWriteWorkload) Setup

func (w *DropCreateWriteWorkload) Setup(client driver.Driver) error

func (*DropCreateWriteWorkload) Start

func (w *DropCreateWriteWorkload) Start(client driver.Driver) (int64, error)

func (*DropCreateWriteWorkload) Type

type IDocument

type IDocument interface {
	ID() int64
}

type InsertOnlyWorkload

type InsertOnlyWorkload struct {
	Threads      int16
	Records      int64
	Database     string
	Collections  []string
	Schemas      [][]byte
	WorkloadData *Queue
}

func (*InsertOnlyWorkload) Check

func (w *InsertOnlyWorkload) Check(client driver.Driver) (bool, error)

func (*InsertOnlyWorkload) Setup

func (w *InsertOnlyWorkload) Setup(client driver.Driver) error

func (*InsertOnlyWorkload) Start

func (w *InsertOnlyWorkload) Start(client driver.Driver) (int64, error)

func (*InsertOnlyWorkload) Type

func (*InsertOnlyWorkload) Type() string

type Nested

type Nested struct {
	Timestamp int64    `fake:"{nanosecond}"         json:"timestamp"`
	Random    string   `fake:"{paragraph:10,10,50}" json:"random"`
	Random1   string   `fake:"{paragraph:10,10,50}" json:"random1"`
	Random2   string   `fake:"{paragraph:10,10,50}" json:"random2"`
	Random3   string   `fake:"{paragraph:10,10,50}" json:"random3"`
	Random4   string   `fake:"{paragraph:10,10,50}" json:"random4"`
	Random5   string   `fake:"{paragraph:10,10,50}" json:"random5"`
	Random6   string   `fake:"{paragraph:10,10,50}" json:"random6"`
	Random7   string   `fake:"{paragraph:10,10,50}" json:"random7"`
	Random8   string   `fake:"{paragraph:10,10,50}" json:"random8"`
	Random9   string   `fake:"{paragraph:10,10,50}" json:"random9"`
	Random10  string   `fake:"{paragraph:10,10,50}" json:"random10"`
	Name      string   `fake:"{paragraph:10,10,50}" json:"name"`
	URL       string   `fake:"{paragraph:10,10,50}" json:"url"`
	Domain    string   `fake:"{sentence:50}"        json:"domain"`
	Sentence  string   `fake:"{paragraph:10,10,50}" json:"sentence"`
	Company   string   `fake:"{paragraph:10,10,50}" json:"company"`
	Labels    []string `fakesize:"20000"            json:"labels"`
	Address   Address  `json:"address"`
	NestedId  string   `fake:"{uuid}"               json:"nested_id"`
}

type Queue

type Queue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue(collections []string) *Queue

func (*Queue) Add

func (q *Queue) Add(collectionName string, doc IDocument)

func (*Queue) Get

func (q *Queue) Get(collectionName string) *QueueDocuments

type QueueDocuments

type QueueDocuments struct {
	sync.Mutex

	Collection string
	Documents  map[int64]IDocument
}

func NewQueueDocuments

func NewQueueDocuments(collection string) *QueueDocuments

func (*QueueDocuments) Add

func (q *QueueDocuments) Add(doc IDocument)

type ReplaceOnlyWorkload

type ReplaceOnlyWorkload struct {
	Threads      int16
	Records      int64
	Database     string
	Collections  []string
	Schemas      [][]byte
	WorkloadData *Queue
}

func (*ReplaceOnlyWorkload) Check

func (w *ReplaceOnlyWorkload) Check(client driver.Driver) (bool, error)

func (*ReplaceOnlyWorkload) Setup

func (w *ReplaceOnlyWorkload) Setup(client driver.Driver) error

func (*ReplaceOnlyWorkload) Start

func (w *ReplaceOnlyWorkload) Start(client driver.Driver) (int64, error)

func (*ReplaceOnlyWorkload) Type

func (*ReplaceOnlyWorkload) Type() string

type SearchOnlyWorkload

type SearchOnlyWorkload struct {
	Threads      int16
	Records      int64
	Project      string
	Index        string
	Schema       []byte
	WorkloadData *Queue
}

func (*SearchOnlyWorkload) Check

func (w *SearchOnlyWorkload) Check(client driver.Driver) (bool, error)

func (*SearchOnlyWorkload) Setup

func (w *SearchOnlyWorkload) Setup(client driver.Driver) error

func (*SearchOnlyWorkload) Start

func (w *SearchOnlyWorkload) Start(client driver.Driver) (int64, error)

func (*SearchOnlyWorkload) Type

func (*SearchOnlyWorkload) Type() string

type SmallConciseWorkload

type SmallConciseWorkload struct {
	Threads      int16
	Records      int64
	Database     string
	Collections  []string
	Schemas      [][]byte
	WorkloadData *Queue
}

func (*SmallConciseWorkload) Check

func (*SmallConciseWorkload) Setup

func (*SmallConciseWorkload) Start

func (w *SmallConciseWorkload) Start(client driver.Driver) (int64, error)

func (*SmallConciseWorkload) Type

func (*SmallConciseWorkload) Type() string

Jump to

Keyboard shortcuts

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