workload

package
v1.0.0-beta.85 Latest Latest
Warning

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

Go to latest
Published: May 8, 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 `json:"city"  fake:"{city}"`
	State   string `json:"state"  fake:"{state}"`
	Country string `json:"country"  fake:"{country}"`
}

type BigPayloadWorkload

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

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 `json:"F2" fake:"{sentence:50}"`
	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  `json:"cars" fake:"{carmaker}" fakesize:"20000"`
	Food      []string  `json:"food" fake:"{food}" fakesize:"20000"`
	CreatedAt time.Time `json:"created_at"  fake:"{date}"`
	UpdatedAt time.Time `json:"updated_at"  fake:"{date}"`
	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    `json:"timestamp" fake:"{nanosecond}"`
	Random    string   `json:"random" fake:"{sentence:10}"`
	Name      string   `json:"name"  fake:"{firstname}"`
	URL       string   `json:"url" fake:"{url}"`
	Domain    string   `json:"domain"  fake:"{domainname}"`
	Sentence  string   `json:"sentence" fake:"{sentence:10}"`
	Company   string   `json:"company"  fake:"{company}"`
	Labels    []string `json:"labels"  fakesize:"20000"`
	Address   Address  `json:"address"`
	NestedId  string   `json:"nested_id"  fake:"{uuid}"`
}

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