simulation

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthSimulator        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSimulator          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupSimulator = fmt.Errorf("proto: unexpected end of group")
)

Functions

func Main

func Main()

Main runs a test

func RegisterSimulatorServiceServer

func RegisterSimulatorServiceServer(s *grpc.Server, srv SimulatorServiceServer)

func Run

func Run(config *Config) error

Run runs the benchmark

Types

type Arg

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

Arg is a simulator argument

func (*Arg) Int

func (a *Arg) Int(def int) int

Int returns the argument as an int

func (*Arg) String

func (a *Arg) String(def string) string

String returns the argument as a string

type Config

type Config struct {
	*job.Config `json:",inline"`
	Simulation  string                   `json:"simulation,omitempty"`
	Simulators  int                      `json:"simulators,omitempty"`
	Duration    time.Duration            `json:"duration,omitempty"`
	Rates       map[string]time.Duration `json:"rates,omitempty"`
	Jitter      map[string]float64       `json:"jitter,omitempty"`
	Args        map[string]string        `json:"args,omitempty"`
}

Config is a simulation configuration

type Coordinator

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

Coordinator coordinates workers for suites of simulators

func (*Coordinator) Run

func (c *Coordinator) Run() error

Run runs the simulations

type ScheduleSimulator

type ScheduleSimulator interface {
	ScheduleSimulator(s *Simulator)
}

ScheduleSimulator is an interface for scheduling operations for a simulation

type SetupSimulation

type SetupSimulation interface {
	SetupSimulation(s *Simulator) error
}

SetupSimulation is an interface for setting up a suite of simulators

type SetupSimulator

type SetupSimulator interface {
	SetupSimulator(s *Simulator) error
}

SetupSimulator is an interface for executing code before every simulator

type SimulatingSuite

type SimulatingSuite interface{}

SimulatingSuite is a suite of simulators

type SimulationLifecycleRequest

type SimulationLifecycleRequest struct {
	// simulation is the simulation name
	Simulation string `protobuf:"bytes,1,opt,name=simulation,proto3" json:"simulation,omitempty"`
	// args is the simulation arguments
	Args map[string]string `` /* 149-byte string literal not displayed */
}

SimulationLifecycleRequest is a simulation request

func (*SimulationLifecycleRequest) Descriptor

func (*SimulationLifecycleRequest) Descriptor() ([]byte, []int)

func (*SimulationLifecycleRequest) GetArgs

func (m *SimulationLifecycleRequest) GetArgs() map[string]string

func (*SimulationLifecycleRequest) GetSimulation

func (m *SimulationLifecycleRequest) GetSimulation() string

func (*SimulationLifecycleRequest) Marshal

func (m *SimulationLifecycleRequest) Marshal() (dAtA []byte, err error)

func (*SimulationLifecycleRequest) MarshalTo

func (m *SimulationLifecycleRequest) MarshalTo(dAtA []byte) (int, error)

func (*SimulationLifecycleRequest) MarshalToSizedBuffer

func (m *SimulationLifecycleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SimulationLifecycleRequest) ProtoMessage

func (*SimulationLifecycleRequest) ProtoMessage()

func (*SimulationLifecycleRequest) Reset

func (m *SimulationLifecycleRequest) Reset()

func (*SimulationLifecycleRequest) Size

func (m *SimulationLifecycleRequest) Size() (n int)

func (*SimulationLifecycleRequest) String

func (m *SimulationLifecycleRequest) String() string

func (*SimulationLifecycleRequest) Unmarshal

func (m *SimulationLifecycleRequest) Unmarshal(dAtA []byte) error

func (*SimulationLifecycleRequest) XXX_DiscardUnknown

func (m *SimulationLifecycleRequest) XXX_DiscardUnknown()

func (*SimulationLifecycleRequest) XXX_Marshal

func (m *SimulationLifecycleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SimulationLifecycleRequest) XXX_Merge

func (m *SimulationLifecycleRequest) XXX_Merge(src proto.Message)

func (*SimulationLifecycleRequest) XXX_Size

func (m *SimulationLifecycleRequest) XXX_Size() int

func (*SimulationLifecycleRequest) XXX_Unmarshal

func (m *SimulationLifecycleRequest) XXX_Unmarshal(b []byte) error

type SimulationLifecycleResponse

type SimulationLifecycleResponse struct {
}

SimulationLifecycleResponse is a response to a SimulationRequest

func (*SimulationLifecycleResponse) Descriptor

func (*SimulationLifecycleResponse) Descriptor() ([]byte, []int)

func (*SimulationLifecycleResponse) Marshal

func (m *SimulationLifecycleResponse) Marshal() (dAtA []byte, err error)

func (*SimulationLifecycleResponse) MarshalTo

func (m *SimulationLifecycleResponse) MarshalTo(dAtA []byte) (int, error)

func (*SimulationLifecycleResponse) MarshalToSizedBuffer

func (m *SimulationLifecycleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SimulationLifecycleResponse) ProtoMessage

func (*SimulationLifecycleResponse) ProtoMessage()

func (*SimulationLifecycleResponse) Reset

func (m *SimulationLifecycleResponse) Reset()

func (*SimulationLifecycleResponse) Size

func (m *SimulationLifecycleResponse) Size() (n int)

func (*SimulationLifecycleResponse) String

func (m *SimulationLifecycleResponse) String() string

func (*SimulationLifecycleResponse) Unmarshal

func (m *SimulationLifecycleResponse) Unmarshal(dAtA []byte) error

func (*SimulationLifecycleResponse) XXX_DiscardUnknown

func (m *SimulationLifecycleResponse) XXX_DiscardUnknown()

func (*SimulationLifecycleResponse) XXX_Marshal

func (m *SimulationLifecycleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SimulationLifecycleResponse) XXX_Merge

func (m *SimulationLifecycleResponse) XXX_Merge(src proto.Message)

func (*SimulationLifecycleResponse) XXX_Size

func (m *SimulationLifecycleResponse) XXX_Size() int

func (*SimulationLifecycleResponse) XXX_Unmarshal

func (m *SimulationLifecycleResponse) XXX_Unmarshal(b []byte) error

type Simulator

type Simulator struct {
	// Name is the name of the simulation
	Name string
	// Process is the unique identifier of the simulator process
	Process int
	// contains filtered or unexported fields
}

Simulator is a simulator runner

func (*Simulator) Arg

func (s *Simulator) Arg(name string) *Arg

Arg gets a simulator argument

func (*Simulator) Schedule

func (s *Simulator) Schedule(name string, f func(*Simulator) error, rate time.Duration, jitter float64)

Schedule schedules an operation

type SimulatorRequest

type SimulatorRequest struct {
	// simulation is the simulation name
	Simulation string `protobuf:"bytes,1,opt,name=simulation,proto3" json:"simulation,omitempty"`
	// register is the register address
	Register string `protobuf:"bytes,2,opt,name=register,proto3" json:"register,omitempty"`
}

SimulatorRequest is a request to run a simulation

func (*SimulatorRequest) Descriptor

func (*SimulatorRequest) Descriptor() ([]byte, []int)

func (*SimulatorRequest) GetRegister

func (m *SimulatorRequest) GetRegister() string

func (*SimulatorRequest) GetSimulation

func (m *SimulatorRequest) GetSimulation() string

func (*SimulatorRequest) Marshal

func (m *SimulatorRequest) Marshal() (dAtA []byte, err error)

func (*SimulatorRequest) MarshalTo

func (m *SimulatorRequest) MarshalTo(dAtA []byte) (int, error)

func (*SimulatorRequest) MarshalToSizedBuffer

func (m *SimulatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SimulatorRequest) ProtoMessage

func (*SimulatorRequest) ProtoMessage()

func (*SimulatorRequest) Reset

func (m *SimulatorRequest) Reset()

func (*SimulatorRequest) Size

func (m *SimulatorRequest) Size() (n int)

func (*SimulatorRequest) String

func (m *SimulatorRequest) String() string

func (*SimulatorRequest) Unmarshal

func (m *SimulatorRequest) Unmarshal(dAtA []byte) error

func (*SimulatorRequest) XXX_DiscardUnknown

func (m *SimulatorRequest) XXX_DiscardUnknown()

func (*SimulatorRequest) XXX_Marshal

func (m *SimulatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SimulatorRequest) XXX_Merge

func (m *SimulatorRequest) XXX_Merge(src proto.Message)

func (*SimulatorRequest) XXX_Size

func (m *SimulatorRequest) XXX_Size() int

func (*SimulatorRequest) XXX_Unmarshal

func (m *SimulatorRequest) XXX_Unmarshal(b []byte) error

type SimulatorResponse

type SimulatorResponse struct {
	// error is a simulation error
	Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
}

SimulatorResponse is a response indicating a simulation output

func (*SimulatorResponse) Descriptor

func (*SimulatorResponse) Descriptor() ([]byte, []int)

func (*SimulatorResponse) GetError

func (m *SimulatorResponse) GetError() string

func (*SimulatorResponse) Marshal

func (m *SimulatorResponse) Marshal() (dAtA []byte, err error)

func (*SimulatorResponse) MarshalTo

func (m *SimulatorResponse) MarshalTo(dAtA []byte) (int, error)

func (*SimulatorResponse) MarshalToSizedBuffer

func (m *SimulatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SimulatorResponse) ProtoMessage

func (*SimulatorResponse) ProtoMessage()

func (*SimulatorResponse) Reset

func (m *SimulatorResponse) Reset()

func (*SimulatorResponse) Size

func (m *SimulatorResponse) Size() (n int)

func (*SimulatorResponse) String

func (m *SimulatorResponse) String() string

func (*SimulatorResponse) Unmarshal

func (m *SimulatorResponse) Unmarshal(dAtA []byte) error

func (*SimulatorResponse) XXX_DiscardUnknown

func (m *SimulatorResponse) XXX_DiscardUnknown()

func (*SimulatorResponse) XXX_Marshal

func (m *SimulatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SimulatorResponse) XXX_Merge

func (m *SimulatorResponse) XXX_Merge(src proto.Message)

func (*SimulatorResponse) XXX_Size

func (m *SimulatorResponse) XXX_Size() int

func (*SimulatorResponse) XXX_Unmarshal

func (m *SimulatorResponse) XXX_Unmarshal(b []byte) error

type SimulatorServiceClient

type SimulatorServiceClient interface {
	SetupSimulation(ctx context.Context, in *SimulationLifecycleRequest, opts ...grpc.CallOption) (*SimulationLifecycleResponse, error)
	TearDownSimulation(ctx context.Context, in *SimulationLifecycleRequest, opts ...grpc.CallOption) (*SimulationLifecycleResponse, error)
	SetupSimulator(ctx context.Context, in *SimulationLifecycleRequest, opts ...grpc.CallOption) (*SimulationLifecycleResponse, error)
	TearDownSimulator(ctx context.Context, in *SimulationLifecycleRequest, opts ...grpc.CallOption) (*SimulationLifecycleResponse, error)
	StartSimulator(ctx context.Context, in *SimulatorRequest, opts ...grpc.CallOption) (*SimulatorResponse, error)
	StopSimulator(ctx context.Context, in *SimulatorRequest, opts ...grpc.CallOption) (*SimulatorResponse, error)
}

SimulatorServiceClient is the client API for SimulatorService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewSimulatorServiceClient

func NewSimulatorServiceClient(cc *grpc.ClientConn) SimulatorServiceClient

type SimulatorServiceServer

SimulatorServiceServer is the server API for SimulatorService service.

type Suite

type Suite struct{}

Suite is an identifier interface for simulation suites

type TearDownSimulation

type TearDownSimulation interface {
	TearDownSimulation(s *Simulator) error
}

TearDownSimulation is an interface for tearing down a suite of simulators

type TearDownSimulator

type TearDownSimulator interface {
	TearDownSimulator(s *Simulator) error
}

TearDownSimulator is an interface for executing code after every simulator

type UnimplementedSimulatorServiceServer

type UnimplementedSimulatorServiceServer struct {
}

UnimplementedSimulatorServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedSimulatorServiceServer) SetupSimulation

func (*UnimplementedSimulatorServiceServer) SetupSimulator

func (*UnimplementedSimulatorServiceServer) StartSimulator

func (*UnimplementedSimulatorServiceServer) StopSimulator

func (*UnimplementedSimulatorServiceServer) TearDownSimulation

func (*UnimplementedSimulatorServiceServer) TearDownSimulator

type WorkerTask

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

WorkerTask manages a single test job for a test worker

func (*WorkerTask) Run

func (t *WorkerTask) Run() (int, error)

Run runs the worker job

Jump to

Keyboard shortcuts

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