Documentation ¶
Index ¶
- Constants
- Variables
- func IsReadWriteInstruction(v Instruction) bool
- func SetLogger(l *logrus.Logger)
- func SetMarshalType(v MarshalType)
- type Client
- func (c *Client) RegisterExecutor(ctx context.Context, r RegisterExecutorOption) error
- func (c *Client) RequestScheduler(ctx context.Context, r RequestSchedulerOption) (SchedulerID, error)
- func (c *Client) RunProgram(ctx context.Context, r RunProgramOption) error
- func (c *Client) Shutdown() error
- func (c *Client) StartComputeNode(ctx context.Context, r StartComputeNodeOption) error
- func (c *Client) UnregisterExecutor(ctx context.Context, r UnregisterExecutorOption) error
- func (c *Client) WaitResult(ctx context.Context, r WaitResultOption) (chan ProgramResult, error)
- type ClientID
- type ClientOption
- type ControlUnitType
- type DatabaseInput
- type DatabasePool
- type EmptyInput
- type EmptyResult
- type ExecuteID
- type Executor
- type ExecutorHandler
- type ExecutorID
- type ExecutorLoadBalancer
- type ExecutorPool
- func (m *ExecutorPool) Add(ctx context.Context, executor Executor) (err error)
- func (m *ExecutorPool) AddServerExecutor() error
- func (m *ExecutorPool) Attach(c *executor) error
- func (m *ExecutorPool) Detach(c *executor) error
- func (m *ExecutorPool) Execute(ctx context.Context, op Instruction, args ...Instruction) (ir InstructionResult, err error)
- func (m *ExecutorPool) FindByHost(ctx context.Context, host Host) (ExecutorID, error)
- func (m *ExecutorPool) GetExecutor(ctx context.Context, op OpCode) (e Executor, eh ExecutorHandler, err error)
- func (m *ExecutorPool) Remove(ctx context.Context, id ExecutorID, removeErr error) (err error)
- type ExecutorRepository
- type Gotlin
- func (g *Gotlin) QueryResult(ctx context.Context, p Program) (interface{}, error)
- func (g *Gotlin) RequestScheduler(ctx context.Context, option SchedulerOption) (SchedulerID, error)
- func (g *Gotlin) RunProgram(ctx context.Context, s SchedulerID, p Program, ins []Instructioner) error
- func (g *Gotlin) RunProgramSync(ctx context.Context, s SchedulerID, p Program, ins []Instructioner) (interface{}, error)
- func (g *Gotlin) StartServer(ctx context.Context) (err error)
- func (g *Gotlin) StopServer(graceful bool) (err error)
- func (g *Gotlin) WaitResult(ctx context.Context, ids []ProgramID) (chan ProgramResult, error)
- type Host
- type ID
- type Immediate
- type Instruction
- func (m Instruction) ChangeDatabaseInput(v DatabaseInput) Instruction
- func (m Instruction) ChangeImmediateValue(value interface{}) Instruction
- func (m Instruction) ChangeState(state State) (Instruction, bool)
- func (m Instruction) ChangeToArithmetic(op OpCode) Instruction
- func (m Instruction) ChangeToWait(value interface{}) Instruction
- func (m Instruction) Finish(result InstructionResult, err error) Instruction
- func (m Instruction) Instruction() Instruction
- func (m Instruction) InstructionResult(ctx context.Context) (interface{}, error)
- func (m Instruction) IsState(state State) bool
- func (m Instruction) OperandValue(ctx context.Context) (interface{}, error)
- func (m Instruction) Reready() Instruction
- type InstructionDAG
- func (d InstructionDAG) Add(ins ...InstructionID) error
- func (d InstructionDAG) Ancestors() []InstructionID
- func (d InstructionDAG) AttachChildren(parent InstructionID, children ...InstructionID) error
- func (d InstructionDAG) Children(parent InstructionID) ([]InstructionID, error)
- func (d InstructionDAG) Iterator(ctx context.Context) chan InstructionID
- func (d InstructionDAG) MarshalString() string
- type InstructionEdge
- type InstructionHandler
- type InstructionID
- type InstructionRef
- type InstructionRefer
- type InstructionRepository
- type InstructionResult
- func ExecuteArithmeticInstruction(ctx context.Context, op Instruction, args ...Instruction) (InstructionResult, error)
- func ExecuteCollectionInstruction(ctx context.Context, op Instruction, args ...Instruction) (InstructionResult, error)
- func ExecuteInputInstruction(ctx context.Context, op Instruction, args ...Instruction) (InstructionResult, error)
- func ExecuteMoveInstruction(ctx context.Context, op Instruction, args ...Instruction) (InstructionResult, error)
- func ExecuteWaitInstruction(ctx context.Context, op Instruction, args ...Instruction) (InstructionResult, error)
- func NewEmptyInstructionResult() InstructionResult
- func NewRegisterResult(u interface{}) InstructionResult
- type InstructionResulter
- type InstructionSet
- func (m *InstructionSet) ClearDefaults()
- func (m *InstructionSet) GetExecutorHandler(op OpCode) (ExecutorHandler, error)
- func (m *InstructionSet) OpCodeLabel() Label
- func (m *InstructionSet) Register(handler InstructionHandler) error
- func (m *InstructionSet) Unregister(handler InstructionHandler) error
- type InstructionVertex
- type Instructioner
- type Label
- type Labels
- type Logger
- type Map
- type Marshal
- type MarshalType
- type OpCode
- type Operand
- type OperandValuer
- type Option
- type Processor
- type ProcessorContext
- type Program
- func (m Program) AddInstruction(id InstructionID) Program
- func (m Program) ChangeProcessor(p ProcessorContext) Program
- func (m Program) ChangeState(state State) (Program, bool)
- func (m Program) ExitOnError(err error) Program
- func (m Program) IsDAGProcessor() bool
- func (m Program) IsPCProcessor() bool
- func (m Program) IsState(state State) bool
- func (m Program) NextPC(id InstructionID) Program
- func (m Program) Reready() Program
- type ProgramCode
- type ProgramID
- type ProgramRepository
- type ProgramResult
- type QueryConverter
- type RegisterExecutorOption
- type RegisterResult
- type RequestSchedulerOption
- type Resource
- type RunProgramOption
- type ScheduledPrograms
- type Scheduler
- type SchedulerID
- type SchedulerOption
- type SchedulerPool
- func (sp *SchedulerPool) Close() error
- func (sp *SchedulerPool) QueryResult(ctx context.Context, p Program) (interface{}, error)
- func (sp *SchedulerPool) RequestScheduler(ctx context.Context, option SchedulerOption) (SchedulerID, error)
- func (sp *SchedulerPool) RunProgram(ctx context.Context, sid SchedulerID, p Program, ins []Instructioner) error
- func (sp *SchedulerPool) RunProgramSync(ctx context.Context, sid SchedulerID, p Program, ins []Instructioner) (value interface{}, err error)
- func (sp *SchedulerPool) WaitResult(ctx context.Context, ids []ProgramID) (chan ProgramResult, error)
- type SchedulerRepository
- type StartComputeNodeOption
- type State
- type StorableDAG
- type Timestamp
- type Unmarshal
- type UnregisterExecutorOption
- type VisitorFunc
- type WaitResultOption
Constants ¶
View Source
const EmptyHost = Host("")
View Source
const OpCodeLabelKey = "opcode"
View Source
const TimestampZero = Timestamp(0)
Variables ¶
View Source
var ( ErrFind = newError("Find") ErrNotFound = newError("Not found") ErrConflict = newError("Conflict") ErrPersistent = newError("Persistent") )
Repository Errors
View Source
var ( ErrConnect = newError("Connect") ErrRequest = newError("Request") ErrExitUnexpectedly = newError("Exit unexpectedly") ErrConverter = newError("Converter") ErrNilPointer = newError("NilPointer") )
Client Errors
View Source
var ( ErrResponse = newError("Response") ErrReceive = newError("Receive") ErrSend = newError("Send") )
Service Errors
View Source
var ( ErrRegisterResult = newError("Only register result is supported for arithmetic instructions") ErrArithmeticOpCode = newError("Only ADD/SUB/MUL/DIV are supported for arithmetic opcode") )
InstructionSet Errors
View Source
var ( ErrProcessorType = newError("Processor type is invalid") ErrProgramState = newError("Program state is invalid") ErrProgramCode = newError("Program code is invalid") ErrProgramResult = newError("Program result is invalid") ErrInstructionState = newError("Instruction state is invalid") ErrInstructions = newError("Instructions is invalid") ErrSchedulerDuplicated = newError("Scheduler duplicated") ErrProgramDuplicated = newError("Program duplicated") ErrInstructionDuplicated = newError("Instruction duplicated") )
Model Errors
View Source
var ( WaitInstructionHandler = InstructionHandler{ OpCode: OpCodeWait, Executor: ExecuteWaitInstruction, } MoveInstructionHandler = InstructionHandler{ OpCode: OpCodeMove, Executor: ExecuteMoveInstruction, } InputInstructionHandler = InstructionHandler{ OpCode: OpCodeIn, Executor: ExecuteInputInstruction, } AddInstructionHandler = InstructionHandler{ OpCode: OpCodeAdd, Executor: ExecuteArithmeticInstruction, } SubInstructionHandler = InstructionHandler{ OpCode: OpCodeSub, Executor: ExecuteArithmeticInstruction, } MulInstructionHandler = InstructionHandler{ OpCode: OpCodeMul, Executor: ExecuteArithmeticInstruction, } DivInstructionHandler = InstructionHandler{ OpCode: OpCodeDiv, Executor: ExecuteArithmeticInstruction, } IntersectInstructionHandler = InstructionHandler{ OpCode: OpCodeIntersect, Executor: ExecuteCollectionInstruction, } UnionInstructionHandler = InstructionHandler{ OpCode: OpCodeUnion, Executor: ExecuteCollectionInstruction, } DiffInstructionHandler = InstructionHandler{ OpCode: OpCodeDiff, Executor: ExecuteCollectionInstruction, } )
View Source
var ( InstructionTableName = "instructions" ProgramTableName = "programs" SchedulerTableName = "schedulers" ExecutorTableName = "executors" )
View Source
var DatabaseFactory = func(driver, dsn string) (*gorm.DB, error) { switch strings.ToLower(driver) { case "mysql": return gorm.Open(mysql.Open(dsn), &gorm.Config{}) case "postgres": return gorm.Open(postgres.Open(dsn), &gorm.Config{}) case "clickhouse": return gorm.Open(clickhouse.Open(dsn), &gorm.Config{}) default: return nil, newErrorf("Database driver %s not supported", driver) } }
View Source
var DefaultInstructionHandlers = []InstructionHandler{ WaitInstructionHandler, MoveInstructionHandler, InputInstructionHandler, AddInstructionHandler, SubInstructionHandler, MulInstructionHandler, DivInstructionHandler, IntersectInstructionHandler, UnionInstructionHandler, DiffInstructionHandler, }
View Source
var EmptyQueryResult = struct{}{}
View Source
var EnvPrefix = "GOTLIN_"
View Source
var (
ErrExecutorNotFound = newError("Executor not found")
)
Executor Errors
View Source
var (
ErrNoMoreInstruction = newError("No more instruction found")
)
Processor Errors
View Source
var (
ErrUndoubted = newError("Undoubted")
)
Common Errors
View Source
var ( MarshalStructs = []interface{}{ Operand{}, EmptyInput{}, Immediate{}, DatabaseInput{}, InstructionResult{}, EmptyResult{}, RegisterResult{}, []interface{}{}, } )
View Source
var ReadWriteInstructions = map[OpCode]bool{ OpCodeIn: true, OpCodeMove: true, }
Functions ¶
func IsReadWriteInstruction ¶
func IsReadWriteInstruction(v Instruction) bool
func SetMarshalType ¶
func SetMarshalType(v MarshalType)
Types ¶
type Client ¶
type Client struct { GRPCOption []grpc.DialOption TargetAddress string InstructionSet *InstructionSet // contains filtered or unexported fields }
func NewClient ¶
func NewClient(options ...ClientOption) (*Client, error)
func (*Client) RegisterExecutor ¶
func (c *Client) RegisterExecutor(ctx context.Context, r RegisterExecutorOption) error
func (*Client) RequestScheduler ¶
func (c *Client) RequestScheduler(ctx context.Context, r RequestSchedulerOption) (SchedulerID, error)
func (*Client) RunProgram ¶
func (c *Client) RunProgram(ctx context.Context, r RunProgramOption) error
func (*Client) StartComputeNode ¶
func (c *Client) StartComputeNode(ctx context.Context, r StartComputeNodeOption) error
func (*Client) UnregisterExecutor ¶
func (c *Client) UnregisterExecutor(ctx context.Context, r UnregisterExecutorOption) error
func (*Client) WaitResult ¶
func (c *Client) WaitResult(ctx context.Context, r WaitResultOption) (chan ProgramResult, error)
type ClientOption ¶
type ClientOption func(*Client)
func WithClientGRPCOptions ¶
func WithClientGRPCOptions(options ...grpc.DialOption) ClientOption
func WithClientInstructionSet ¶
func WithClientInstructionSet(is *InstructionSet) ClientOption
func WithClientTargetAddress ¶
func WithClientTargetAddress(addr string) ClientOption
type ControlUnitType ¶
type ControlUnitType string
const ( ControlUnitTypePC ControlUnitType = "ProgramCounter" ControlUnitTypeDAG ControlUnitType = "DAG" )
type DatabaseInput ¶
type DatabaseInput struct { Driver string DSN string Query string Converters []QueryConverter }
func NewDatabaseInput ¶
func NewDatabaseInput(driver, dsn, query string, converters []QueryConverter) DatabaseInput
func (DatabaseInput) OperandValue ¶
func (v DatabaseInput) OperandValue(ctx context.Context) (interface{}, error)
func (DatabaseInput) Type ¶
func (v DatabaseInput) Type() string
type DatabasePool ¶
type DatabasePool struct {
// contains filtered or unexported fields
}
func NewDatabasePool ¶
func NewDatabasePool() DatabasePool
type EmptyInput ¶
type EmptyInput struct { }
func (EmptyInput) OperandValue ¶
func (EmptyInput) OperandValue(context.Context) (interface{}, error)
func (EmptyInput) Type ¶
func (EmptyInput) Type() string
type EmptyResult ¶
type EmptyResult struct { }
func (EmptyResult) InstructionResult ¶
func (EmptyResult) InstructionResult(context.Context) (interface{}, error)
func (EmptyResult) Type ¶
func (EmptyResult) Type() string
type ExecuteID ¶
type ExecuteID = ID
func NewExecuteID ¶
func NewExecuteID() ExecuteID
func ParseExecuteID ¶
type Executor ¶
type Executor struct { ID ExecutorID Labels Labels Host Host State State Error error Limits Resource Usages Resource CreateTime Timestamp UpdateTime Timestamp FinishTime Timestamp }
func NewExecutor ¶
func NewExecutor() Executor
func (Executor) ExitOnError ¶
func (Executor) IsEmptyHost ¶
type ExecutorHandler ¶
type ExecutorHandler func(context.Context, Instruction, ...Instruction) (InstructionResult, error)
type ExecutorID ¶
type ExecutorID = ID
func NewExecutorID ¶
func NewExecutorID() ExecutorID
func ParseExecutorID ¶
func ParseExecutorID(s string) (ExecutorID, error)
type ExecutorLoadBalancer ¶
type ExecutorPool ¶
type ExecutorPool struct { ExecutorRepository ExecutorRepository // contains filtered or unexported fields }
func NewExecutorPool ¶
func NewExecutorPool(er ExecutorRepository, is *InstructionSet) *ExecutorPool
func (*ExecutorPool) Add ¶
func (m *ExecutorPool) Add(ctx context.Context, executor Executor) (err error)
func (*ExecutorPool) AddServerExecutor ¶
func (m *ExecutorPool) AddServerExecutor() error
func (*ExecutorPool) Attach ¶
func (m *ExecutorPool) Attach(c *executor) error
func (*ExecutorPool) Detach ¶
func (m *ExecutorPool) Detach(c *executor) error
func (*ExecutorPool) Execute ¶
func (m *ExecutorPool) Execute(ctx context.Context, op Instruction, args ...Instruction) (ir InstructionResult, err error)
func (*ExecutorPool) FindByHost ¶
func (m *ExecutorPool) FindByHost(ctx context.Context, host Host) (ExecutorID, error)
func (*ExecutorPool) GetExecutor ¶
func (m *ExecutorPool) GetExecutor(ctx context.Context, op OpCode) (e Executor, eh ExecutorHandler, err error)
func (*ExecutorPool) Remove ¶
func (m *ExecutorPool) Remove(ctx context.Context, id ExecutorID, removeErr error) (err error)
type ExecutorRepository ¶
type Gotlin ¶
type Gotlin struct { SchedulerRepository SchedulerRepository ProgramRepository ProgramRepository InstructionRepository InstructionRepository ExecutorRepository ExecutorRepository EnableServer bool ServerAddress string ServerExecutor bool GRPCOption []grpc.ServerOption // contains filtered or unexported fields }
func (*Gotlin) QueryResult ¶
func (*Gotlin) RequestScheduler ¶
func (g *Gotlin) RequestScheduler(ctx context.Context, option SchedulerOption) (SchedulerID, error)
func (*Gotlin) RunProgram ¶
func (g *Gotlin) RunProgram(ctx context.Context, s SchedulerID, p Program, ins []Instructioner) error
func (*Gotlin) RunProgramSync ¶
func (g *Gotlin) RunProgramSync(ctx context.Context, s SchedulerID, p Program, ins []Instructioner) (interface{}, error)
func (*Gotlin) StopServer ¶
func (*Gotlin) WaitResult ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
func (ID) MarshalJSON ¶
func (ID) NonceString ¶
func (*ID) UnmarshalJSON ¶
type Instruction ¶
type Instruction struct { ID InstructionID OpCode OpCode Operand Operand Result InstructionResult State State Error error CreateTime Timestamp UpdateTime Timestamp FinishTime Timestamp }
func NewInstruction ¶
func NewInstruction() Instruction
func (Instruction) ChangeDatabaseInput ¶
func (m Instruction) ChangeDatabaseInput(v DatabaseInput) Instruction
func (Instruction) ChangeImmediateValue ¶
func (m Instruction) ChangeImmediateValue(value interface{}) Instruction
func (Instruction) ChangeState ¶
func (m Instruction) ChangeState(state State) (Instruction, bool)
func (Instruction) ChangeToArithmetic ¶
func (m Instruction) ChangeToArithmetic(op OpCode) Instruction
func (Instruction) ChangeToWait ¶
func (m Instruction) ChangeToWait(value interface{}) Instruction
func (Instruction) Finish ¶
func (m Instruction) Finish(result InstructionResult, err error) Instruction
func (Instruction) Instruction ¶
func (m Instruction) Instruction() Instruction
func (Instruction) InstructionResult ¶
func (m Instruction) InstructionResult(ctx context.Context) (interface{}, error)
func (Instruction) IsState ¶
func (m Instruction) IsState(state State) bool
func (Instruction) OperandValue ¶
func (m Instruction) OperandValue(ctx context.Context) (interface{}, error)
func (Instruction) Reready ¶
func (m Instruction) Reready() Instruction
type InstructionDAG ¶
type InstructionDAG struct {
// contains filtered or unexported fields
}
func NewInstructionDAG ¶
func NewInstructionDAG() InstructionDAG
func ParseInstructionDAG ¶
func ParseInstructionDAG(s string) (InstructionDAG, error)
func (InstructionDAG) Add ¶
func (d InstructionDAG) Add(ins ...InstructionID) error
func (InstructionDAG) Ancestors ¶
func (d InstructionDAG) Ancestors() []InstructionID
func (InstructionDAG) AttachChildren ¶
func (d InstructionDAG) AttachChildren(parent InstructionID, children ...InstructionID) error
func (InstructionDAG) Children ¶
func (d InstructionDAG) Children(parent InstructionID) ([]InstructionID, error)
func (InstructionDAG) Iterator ¶
func (d InstructionDAG) Iterator(ctx context.Context) chan InstructionID
func (InstructionDAG) MarshalString ¶
func (d InstructionDAG) MarshalString() string
type InstructionEdge ¶
func (InstructionEdge) Edge ¶
func (e InstructionEdge) Edge() (srcID, dstID string)
type InstructionHandler ¶
type InstructionHandler struct { OpCode OpCode Executor ExecutorHandler }
type InstructionID ¶
type InstructionID = ID
func NewInstructionID ¶
func NewInstructionID() InstructionID
func ParseInstructionID ¶
func ParseInstructionID(s string) (InstructionID, error)
type InstructionRef ¶
type InstructionRef struct {
// contains filtered or unexported fields
}
func NewInstructionRef ¶
func NewInstructionRef(in Instruction) InstructionRef
func (InstructionRef) Instruction ¶
func (m InstructionRef) Instruction() Instruction
func (InstructionRef) IsRef ¶
func (m InstructionRef) IsRef()
type InstructionRefer ¶
type InstructionRefer interface { Instructioner IsRef() }
type InstructionRepository ¶
type InstructionRepository interface { Find(context.Context, InstructionID) (Instruction, error) Save(context.Context, *Instruction) error }
type InstructionResult ¶
type InstructionResult struct { Type string Result InstructionResulter }
func ExecuteArithmeticInstruction ¶
func ExecuteArithmeticInstruction(ctx context.Context, op Instruction, args ...Instruction) (InstructionResult, error)
func ExecuteCollectionInstruction ¶
func ExecuteCollectionInstruction(ctx context.Context, op Instruction, args ...Instruction) (InstructionResult, error)
func ExecuteInputInstruction ¶
func ExecuteInputInstruction(ctx context.Context, op Instruction, args ...Instruction) (InstructionResult, error)
func ExecuteMoveInstruction ¶
func ExecuteMoveInstruction(ctx context.Context, op Instruction, args ...Instruction) (InstructionResult, error)
func ExecuteWaitInstruction ¶
func ExecuteWaitInstruction(ctx context.Context, op Instruction, args ...Instruction) (InstructionResult, error)
func NewEmptyInstructionResult ¶
func NewEmptyInstructionResult() InstructionResult
func NewRegisterResult ¶
func NewRegisterResult(u interface{}) InstructionResult
func (InstructionResult) InstructionResult ¶
func (v InstructionResult) InstructionResult(ctx context.Context) (interface{}, error)
func (InstructionResult) RegisterValue ¶
func (v InstructionResult) RegisterValue() (interface{}, bool)
func (*InstructionResult) UnmarshalJSON ¶
func (v *InstructionResult) UnmarshalJSON(data []byte) (err error)
func (*InstructionResult) UnmarshalMsgpack ¶
func (v *InstructionResult) UnmarshalMsgpack(data []byte) error
type InstructionResulter ¶
type InstructionSet ¶
type InstructionSet struct {
// contains filtered or unexported fields
}
func NewInstructionSet ¶
func NewInstructionSet() *InstructionSet
func (*InstructionSet) ClearDefaults ¶
func (m *InstructionSet) ClearDefaults()
func (*InstructionSet) GetExecutorHandler ¶
func (m *InstructionSet) GetExecutorHandler(op OpCode) (ExecutorHandler, error)
func (*InstructionSet) OpCodeLabel ¶
func (m *InstructionSet) OpCodeLabel() Label
func (*InstructionSet) Register ¶
func (m *InstructionSet) Register(handler InstructionHandler) error
func (*InstructionSet) Unregister ¶
func (m *InstructionSet) Unregister(handler InstructionHandler) error
type InstructionVertex ¶
type InstructionVertex struct { WrappedID string `json:"i"` InstructionID InstructionID `json:"v"` }
func NewInstructionVertex ¶
func NewInstructionVertex(id string, in InstructionID) InstructionVertex
func (InstructionVertex) ID ¶
func (v InstructionVertex) ID() string
func (InstructionVertex) Vertex ¶
func (v InstructionVertex) Vertex() (id string, value interface{})
type Instructioner ¶
type Instructioner interface {
Instruction() Instruction
}
type Logger ¶
type Logger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Debug(args ...interface{}) Info(args ...interface{}) Print(args ...interface{}) Warn(args ...interface{}) Debugln(args ...interface{}) Infoln(args ...interface{}) Println(args ...interface{}) Warnln(args ...interface{}) }
type MarshalType ¶
type MarshalType string
var ( MarshalTypeJSON MarshalType = "json" MarshalTypeMsgPack MarshalType = "msgpack" MarshalTypeGob MarshalType = "gob" )
type Operand ¶
type Operand struct { Type string Value OperandValuer }
func NewDatabaseInputOperand ¶
func NewDatabaseInputOperand(v DatabaseInput) Operand
func NewEmptyOperand ¶
func NewEmptyOperand() Operand
func NewImmediateValue ¶
func NewImmediateValue(u interface{}) Operand
func (*Operand) ImmediateValue ¶
func (Operand) OperandValue ¶
func (*Operand) UnmarshalJSON ¶
func (*Operand) UnmarshalMsgpack ¶
type OperandValuer ¶
type Option ¶
type Option func(g *Gotlin)
func WithDatabase ¶
func WithEnableServer ¶
func WithGRPCServerOption ¶
func WithGRPCServerOption(options ...grpc.ServerOption) Option
func WithInstructionSet ¶
func WithInstructionSet(is *InstructionSet) Option
func WithServerAddress ¶
func WithServerExecutor ¶
type ProcessorContext ¶
type ProcessorContext struct { ControlUnit ControlUnitType Core int Data string }
func NewDAGProcessorContext ¶
func NewDAGProcessorContext(d InstructionDAG, core int) ProcessorContext
func NewProcessorContext ¶
func NewProcessorContext() ProcessorContext
func (ProcessorContext) ChangePC ¶
func (v ProcessorContext) ChangePC(id InstructionID) ProcessorContext
func (ProcessorContext) CurrentPC ¶
func (v ProcessorContext) CurrentPC() (InstructionID, bool)
func (ProcessorContext) IsDAG ¶
func (v ProcessorContext) IsDAG() bool
func (ProcessorContext) IsPC ¶
func (v ProcessorContext) IsPC() bool
type Program ¶
type Program struct { ID ProgramID Code ProgramCode State State Error error Processor ProcessorContext CreateTime Timestamp UpdateTime Timestamp FinishTime Timestamp }
func NewProgram ¶
func NewProgram() Program
func (Program) AddInstruction ¶
func (m Program) AddInstruction(id InstructionID) Program
func (Program) ChangeProcessor ¶
func (m Program) ChangeProcessor(p ProcessorContext) Program
func (Program) ExitOnError ¶
func (Program) IsDAGProcessor ¶
func (Program) IsPCProcessor ¶
func (Program) NextPC ¶
func (m Program) NextPC(id InstructionID) Program
type ProgramCode ¶
type ProgramCode struct {
Instructions []InstructionID
}
func NewProgramCode ¶
func NewProgramCode() ProgramCode
func (ProgramCode) AddInstruction ¶
func (v ProgramCode) AddInstruction(id InstructionID) ProgramCode
func (ProgramCode) IsEqual ¶
func (v ProgramCode) IsEqual(v2 ProgramCode) bool
type ProgramID ¶
type ProgramID = ID
func NewProgramID ¶
func NewProgramID() ProgramID
func ParseProgramID ¶
type ProgramRepository ¶
type ProgramResult ¶
type QueryConverter ¶
type QueryConverter string
const QueryConverterFirstValue QueryConverter = "FirstValue"
const QueryConverterFlat QueryConverter = "Flat"
type RegisterExecutorOption ¶
type RegisterExecutorOption struct { ID ExecutorID Host Host Labels Labels CallOptions []grpc.CallOption }
type RegisterResult ¶
type RegisterResult struct {
Value interface{}
}
func (RegisterResult) InstructionResult ¶
func (v RegisterResult) InstructionResult(context.Context) (interface{}, error)
func (RegisterResult) Type ¶
func (RegisterResult) Type() string
type RequestSchedulerOption ¶
type RequestSchedulerOption struct { SchedulerOption CallOptions []grpc.CallOption }
type Resource ¶
func NewEmptyResource ¶
func NewEmptyResource() Resource
type RunProgramOption ¶
type RunProgramOption struct { SchedulerID SchedulerID Program Program Instructions []Instructioner CallOptions []grpc.CallOption }
type ScheduledPrograms ¶
type ScheduledPrograms struct {
Programs []ProgramID
}
func NewScheduledPrograms ¶
func NewScheduledPrograms() ScheduledPrograms
func (ScheduledPrograms) AddProgram ¶
func (v ScheduledPrograms) AddProgram(id ProgramID) ScheduledPrograms
type Scheduler ¶
type Scheduler struct { ID SchedulerID Programs ScheduledPrograms CreateTime Timestamp UpdateTime Timestamp FinishTime Timestamp }
func NewScheduler ¶
func NewScheduler() Scheduler
func (Scheduler) AddProgram ¶
type SchedulerID ¶
type SchedulerID = ID
func NewSchedulerID ¶
func NewSchedulerID() SchedulerID
func ParseSchedulerID ¶
func ParseSchedulerID(s string) (SchedulerID, error)
type SchedulerOption ¶
type SchedulerOption struct {
// contains filtered or unexported fields
}
func NewSchedulerOption ¶
func NewSchedulerOption() SchedulerOption
type SchedulerPool ¶
type SchedulerPool struct { ExecutorPool *ExecutorPool SchedulerRepository SchedulerRepository ProgramRepository ProgramRepository InstructionRepository InstructionRepository // contains filtered or unexported fields }
func NewSchedulerPool ¶
func NewSchedulerPool(ep *ExecutorPool, sr SchedulerRepository, pr ProgramRepository, ir InstructionRepository) *SchedulerPool
func (*SchedulerPool) Close ¶
func (sp *SchedulerPool) Close() error
func (*SchedulerPool) QueryResult ¶
func (sp *SchedulerPool) QueryResult(ctx context.Context, p Program) (interface{}, error)
func (*SchedulerPool) RequestScheduler ¶
func (sp *SchedulerPool) RequestScheduler(ctx context.Context, option SchedulerOption) (SchedulerID, error)
func (*SchedulerPool) RunProgram ¶
func (sp *SchedulerPool) RunProgram(ctx context.Context, sid SchedulerID, p Program, ins []Instructioner) error
func (*SchedulerPool) RunProgramSync ¶
func (sp *SchedulerPool) RunProgramSync(ctx context.Context, sid SchedulerID, p Program, ins []Instructioner) (value interface{}, err error)
func (*SchedulerPool) WaitResult ¶
func (sp *SchedulerPool) WaitResult(ctx context.Context, ids []ProgramID) (chan ProgramResult, error)
type SchedulerRepository ¶
type StartComputeNodeOption ¶
type StartComputeNodeOption struct {
CallOptions []grpc.CallOption
}
type StorableDAG ¶
type StorableDAG struct { InstructionVertices []InstructionVertex `json:"vs"` InstructionEdges []InstructionEdge `json:"es"` }
func (StorableDAG) Edges ¶
func (d StorableDAG) Edges() []dag.Edger
func (StorableDAG) Vertices ¶
func (d StorableDAG) Vertices() []dag.Vertexer
type Timestamp ¶
type Timestamp int64
func NewTimestamp ¶
func NewTimestamp() Timestamp
func ParseTimestamp ¶
type UnregisterExecutorOption ¶
type UnregisterExecutorOption struct { ID ExecutorID Error error CallOptions []grpc.CallOption }
type VisitorFunc ¶
func (VisitorFunc) Visit ¶
func (f VisitorFunc) Visit(v dag.Vertexer)
type WaitResultOption ¶
type WaitResultOption struct { IDs []ProgramID CallOptions []grpc.CallOption }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.