core

package
v0.0.0-...-6f25ba1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IterationResult

type IterationResult struct {
	Norm         []float64
	IndexX       int
	IndexY       int
	MaxIteration int32
	ResultIt     []int
}

type Leader

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

Leader node instance type

func GetLeader

func GetLeader(
	host string,
	colorStep int,
	width int,
	height int,
	xPos float64,
	yPos float64,
	escapeRadius float64,
	smoothness int,
	iters int,
	palette string,
	outfile string,
	forceExit, quiet, metrics bool,
) (*Leader, error)

GetLeader returns the leader node instance

func (*Leader) Init

func (n *Leader) Init() (err error)

Init initializes the leader

func (*Leader) Port

func (n *Leader) Port() string

Port returns the port of the leader

func (*Leader) RenderDistributed

func (n *Leader) RenderDistributed(colors []color.RGBA, done chan struct{})

RenderDistributed sends work to the worker channel

func (*Leader) Start

func (n *Leader) Start()

type MandelIteration

type MandelIteration struct {
	Xmin         float64
	Ymin         float64
	Xmax         float64
	Ymax         float64
	IndexY       int
	Width        int
	MaxIteration int
}

A mandel iteration holds values that a worker needs to calculate a single pixel value

type NodeServiceGrpcServer

type NodeServiceGrpcServer struct {
	pb.UnimplementedNodeServiceServer
	ResultChannel chan IterationResult
	WorkChannel   chan MandelIteration
}

func GetNodeServiceGrpcServer

func GetNodeServiceGrpcServer() *NodeServiceGrpcServer

GetNodeServiceGrpcServer singleton service

func (NodeServiceGrpcServer) AssignTask

func (n NodeServiceGrpcServer) AssignTask(request *pb.Request, server pb.NodeService_AssignTaskServer) error

func (NodeServiceGrpcServer) ReportResult

func (n NodeServiceGrpcServer) ReportResult(ctx context.Context, result *pb.WorkResponse) (*pb.Response, error)

Report a result to the leader

func (NodeServiceGrpcServer) ReportStatus

func (n NodeServiceGrpcServer) ReportStatus(ctx context.Context, request *pb.Request) (*pb.Response, error)

ReportStatus reports a worker status Assume it's at the start of a run and we set reporting of metrics back to false

type WorkerNode

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

func GetWorkerNode

func GetWorkerNode(host string, retries int, quiet bool) *WorkerNode

func (*WorkerNode) ConnectStream

func (n *WorkerNode) ConnectStream() (pb.NodeService_AssignTaskClient, error)

Connect to the stream with some backoff

func (*WorkerNode) Init

func (n *WorkerNode) Init() (err error)

func (*WorkerNode) Start

func (n *WorkerNode) Start() error

Jump to

Keyboard shortcuts

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