benchmark

package
v0.0.0-...-bc78c8b Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input = domain.BenchmarkInput

Input is an alias for BenchmarkInput

type Output

type Output = domain.BenchmarkOutput

Output is an alias for BenchmarkOutput

type Repository

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

Repository stores and returns benchmarks documents

func NewRepository

func NewRepository(repo domain.Repository) *Repository

NewRepository returns an instance of benchmark repository

func (*Repository) DeleteByID

func (r *Repository) DeleteByID(id string) error

DeleteByID deletes one benchmark

func (*Repository) FindAll

func (r *Repository) FindAll() (*[]domain.Benchmark, error)

FindAll returns every benchmark

func (*Repository) InsertOne

func (r *Repository) InsertOne(benchmark *domain.Benchmark) error

InsertOne creates one benchmark

func (*Repository) UpdateBenchmarkCompleted

func (r *Repository) UpdateBenchmarkCompleted(id string, output *domain.BenchmarkOutput) error

UpdateBenchmarkCompleted updates one benchmark

type RepositoryInMemory

type RepositoryInMemory struct {
	Benchmarks []domain.Benchmark
}

RepositoryInMemory stores benchmarks in memory

func NewRepositoryInMemory

func NewRepositoryInMemory() *RepositoryInMemory

NewRepositoryInMemory returns an instance of RepositoryInMemory

func (*RepositoryInMemory) DeleteByID

func (r *RepositoryInMemory) DeleteByID(id string) error

DeleteByID removes a benchmark from store

func (*RepositoryInMemory) FindAll

func (r *RepositoryInMemory) FindAll() (*[]domain.Benchmark, error)

FindAll returns all benchmarks stored

func (*RepositoryInMemory) InsertOne

func (r *RepositoryInMemory) InsertOne(benchmark *domain.Benchmark) error

InsertOne creates a benchmark and stores it in a data structure

func (*RepositoryInMemory) UpdateBenchmarkCompleted

func (r *RepositoryInMemory) UpdateBenchmarkCompleted(id string, output *domain.BenchmarkOutput) error

UpdateBenchmarkCompleted updates benchmark status

type Service

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

Service is a service with all methods to interact with benchmark related functions

func NewService

func NewService(repo domain.BenchmarksRepository, assetpriceRepository domain.AssetPriceRepository, applicationExecutionStatesRepository domain.ApplicationExecutionStateRepository) *Service

NewService returns an instance of Service

func (*Service) AggregateApplicationState

func (s *Service) AggregateApplicationState(pipeline mongo.Pipeline) (*[]bson.M, error)

AggregateApplicationState returns an aggregate of application state

func (*Service) BulkRun

func (s *Service) BulkRun(inputs []Input, c chan domain.BenchmarkResult)

BulkRun runs multiple benchmarks concurrently

func (*Service) Create

func (s *Service) Create(input domain.BenchmarkInput) (*domain.Benchmark, error)

Create inserts one benchmark in database

func (*Service) DeleteByID

func (s *Service) DeleteByID(id string) error

DeleteByID removes one benchmark from database

func (*Service) FindAll

func (s *Service) FindAll() (*[]domain.Benchmark, error)

FindAll returns every benchmark

func (*Service) GetDataSources

func (s *Service) GetDataSources() map[string]map[string]string

GetDataSources returns all available data sources

func (*Service) HandleBenchmark

func (s *Service) HandleBenchmark(benchmark *domain.Benchmark) error

HandleBenchmark executes benchmark and updates database accordingly

func (*Service) Run

func (s *Service) Run(input Input, benchmarkID *primitive.ObjectID) (*Output, error)

Run executes benchmark and returns performance results

Jump to

Keyboard shortcuts

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