models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknown = errors.New("unknown model")

ErrUnknown is used when a model could not be found.

Functions

This section is empty.

Types

type ModelExperimentInput

type ModelExperimentInput struct {
	IdentifierParams struct {
		Name      string  `json:"name"`
		From      float64 `json:"from"`
		To        float64 `json:"to"`
		Increment float64 `json:"increment"`
	} `json:"identifier"`
	MaxIterations *uint    `json:"maxIterations"`
	Tolerance     *float64 `json:"tolerance"`
}

type ModelSolutionInput

type ModelSolutionInput struct {
	MaxIterations     *uint                  `json:"maxIterations,omitempty"`
	Tolerance         *float64               `json:"tolerance,omitempty"`
	CustomIdentifiers map[string]interface{} `json:"customIdentifiers,omitempty"`
}

type Repository

type Repository interface {
	Store(model *SanModel) error
	Find(id SanModelID) (*SanModel, error)
	All() ([]*SanModel, error)
}

type SanModel

type SanModel struct {
	ID              SanModelID
	Name            string
	Title           string
	Description     string
	Source          string
	Hash            string
	TransitionsHash string
	ParsedModel     *sanmodel.Model
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

type SanModelID

type SanModelID string

func NextSanModelID

func NextSanModelID() SanModelID

type Service

type Service interface {
	Create(input *UpsertInput) (SanModelID, error)
	Find(id SanModelID) (*SanModel, error)
	Update(id SanModelID, input *UpsertInput) (*SanModel, error)
	All() ([]*SanModel, error)
	RenderGraph(id SanModelID, out io.Writer) error
	ScheduleSolution(id SanModelID, req *ModelSolutionInput) (*solver.Solution, error)
	FindSolution(id SanModelID, solutionID solver.SolutionID) (*solver.Solution, error)
	ScheduleExperiment(id SanModelID, req *ModelExperimentInput) (*solver.Experiment, error)
	FindExperiment(id SanModelID, experimentID solver.ExperimentID) (*solver.Experiment, error)
}

func NewService

func NewService(repo Repository, compiler compiler.Service, renderer renderer.Service, solver solver.Service) Service

type UpsertInput

type UpsertInput struct {
	Source      *string `json:"source"`
	Title       *string `json:"title"`
	Description *string `json:"description"`
}

Jump to

Keyboard shortcuts

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