mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
bceb1727d1
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
43 lines
961 B
Go
43 lines
961 B
Go
// Copyright (c) Ultraviolet
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
package vm
|
|
|
|
import (
|
|
"github.com/ultravioletrs/cocos/agent"
|
|
pkgmanager "github.com/ultravioletrs/cocos/pkg/manager"
|
|
"google.golang.org/protobuf/types/known/timestamppb"
|
|
)
|
|
|
|
// VM represents a virtual machine.
|
|
type VM interface {
|
|
Start() error
|
|
Stop() error
|
|
SendAgentConfig(ac agent.Computation) error
|
|
SetProcess(pid int) error
|
|
GetProcess() int
|
|
GetCID() int
|
|
Transition(newState pkgmanager.ManagerState) error
|
|
State() string
|
|
GetConfig() interface{}
|
|
}
|
|
|
|
type Provider func(config interface{}, eventSender EventSender, computationId string) VM
|
|
|
|
type Event struct {
|
|
EventType string
|
|
Timestamp *timestamppb.Timestamp
|
|
ComputationId string
|
|
Details []byte
|
|
Originator string
|
|
Status string
|
|
}
|
|
|
|
type Log struct {
|
|
Message string
|
|
ComputationId string
|
|
Level string
|
|
Timestamp *timestamppb.Timestamp
|
|
}
|
|
|
|
type EventSender func(event interface{}) error
|