Documentation ¶
Index ¶
- Constants
- Variables
- func ParseAddr(addr string) (map[string]string, error)
- type Centrum
- func (c Centrum) ConnectWorker() (map[string]interface{}, error)
- func (c Centrum) DisconnectWorker() (map[string]interface{}, error)
- func (c Centrum) GetDispatchers() (map[string]interface{}, error)
- func (c Centrum) GetToken() string
- func (c *Centrum) NewDisptcher(pub, ip string, port int) error
- func (c *Centrum) SetToken(token string)
- func (c Centrum) Sleep() (map[string]interface{}, error)
- func (c Centrum) Wake(pub, ip string, port int) (map[string]interface{}, error)
- type Dispatcher
- func (d *Dispatcher) AddJob(j job.Job)
- func (d *Dispatcher) AddPeer(p string, c *client.Client)
- func (d *Dispatcher) AddWorker(pub string)
- func (d Dispatcher) Batch(jrs []string) (string, error)
- func (d Dispatcher) BlockByHash(hash string) (string, error)
- func (d Dispatcher) BlockByHeight(height int) (string, error)
- func (d Dispatcher) BlockHashesHex() ([]string, error)
- func (d Dispatcher) BlockReq(ctx context.Context, args wamp.List, kwargs, details wamp.Dict) *client.InvokeResult
- func (d *Dispatcher) BlockSubscribe(peer *client.Client)
- func (d Dispatcher) CancelExec(hash string) error
- func (d Dispatcher) Chain(jrs []string) (string, error)
- func (d Dispatcher) Chord(jrs []string, callbackJr string) (string, error)
- func (d *Dispatcher) EmptyJobs()
- func (d Dispatcher) ExecArgs(id string, hash string) ([]interface{}, error)
- func (d Dispatcher) ExecBackoff(id string, hash string) (float64, error)
- func (d Dispatcher) ExecBy(id string, hash string) (string, error)
- func (d Dispatcher) ExecDurationMinutes(id string, hash string) (float64, error)
- func (d Dispatcher) ExecDurationNanoseconds(id string, hash string) (int64, error)
- func (d Dispatcher) ExecDurationSeconds(id string, hash string) (float64, error)
- func (d Dispatcher) ExecDurationString(id string, hash string) (string, error)
- func (d Dispatcher) ExecErr(id string, hash string) (interface{}, error)
- func (d Dispatcher) ExecExecutionTime(id string, hash string) (int64, error)
- func (d Dispatcher) ExecExecutionTimeString(id string, hash string) (string, error)
- func (d Dispatcher) ExecInterval(id string, hash string) (int, error)
- func (d Dispatcher) ExecPriority(id string, hash string) (int, error)
- func (d Dispatcher) ExecResult(id string, hash string) (interface{}, error)
- func (d Dispatcher) ExecRetries(id string, hash string) (int, error)
- func (d Dispatcher) ExecStatus(id string, hash string) (string, error)
- func (d Dispatcher) ExecTTLHours(id string, hash string) (float64, error)
- func (d Dispatcher) ExecTTLMinutes(id string, hash string) (float64, error)
- func (d Dispatcher) ExecTTLNanoseconds(id string, hash string) (int64, error)
- func (d Dispatcher) ExecTTLSeconds(id string, hash string) (float64, error)
- func (d Dispatcher) ExecTTLString(id string, hash string) (string, error)
- func (d Dispatcher) ExecTimestamp(id string, hash string) (int64, error)
- func (d Dispatcher) ExecTimestampString(id string, hash string) (string, error)
- func (d Dispatcher) GetAssignedWorker(hash string) string
- func (d Dispatcher) GetBC() *core.BlockChain
- func (d Dispatcher) GetBench() benchmark.Engine
- func (d Dispatcher) GetBenchmarks() []benchmark.Benchmark
- func (d *Dispatcher) GetDispatchersAndSync()
- func (d Dispatcher) GetIP() string
- func (d Dispatcher) GetJC() *cache.JobCache
- func (d Dispatcher) GetJobPQ() *queue.JobPriorityQueue
- func (d Dispatcher) GetJobs() map[string]job.Job
- func (d Dispatcher) GetPeers() map[string]*client.Client
- func (d Dispatcher) GetPort() int
- func (d Dispatcher) GetPrivByte() []byte
- func (d Dispatcher) GetPrivString() string
- func (d Dispatcher) GetPubByte() []byte
- func (d Dispatcher) GetPubString() string
- func (d Dispatcher) GetRPC() *rpc.HTTPService
- func (d Dispatcher) GetUptime() int64
- func (d Dispatcher) GetUptimeString() string
- func (d Dispatcher) GetWorker(s string) *WorkerInfo
- func (d Dispatcher) GetWorkerPQ() *WorkerPriorityQueue
- func (d Dispatcher) GetWorkers() map[string]*WorkerInfo
- func (d Dispatcher) GetWriteQ() *lane.Queue
- func (d Dispatcher) IsJobPrivate(id string) (bool, error)
- func (d Dispatcher) Job(id string) (string, error)
- func (d Dispatcher) JobExecs(id string) (string, error)
- func (d Dispatcher) JobLatestExec(id string) (string, error)
- func (d Dispatcher) JobName(id string) (string, error)
- func (d Dispatcher) JobQueueCount() int
- func (d Dispatcher) JobSubmisstionTimeString(id string) (string, error)
- func (d Dispatcher) JobSubmisstionTimeUnix(id string) (int64, error)
- func (d Dispatcher) KeyPair() (string, error)
- func (d Dispatcher) Latest15Blocks() (string, error)
- func (d Dispatcher) LatestBlock() (string, error)
- func (d Dispatcher) LatestBlockHeight() (int, error)
- func (d Dispatcher) NewExec(args []interface{}, retries, priority int, backoff int64, execTime int64, ...) (string, error)
- func (d Dispatcher) NewJob(task string, name string, priv bool, privKey string) (string, error)
- func (d Dispatcher) PeerCount() int
- func (d Dispatcher) PendingCount() int
- func (d Dispatcher) PublicKey() string
- func (d Dispatcher) RPC()
- func (d Dispatcher) Register()
- func (d Dispatcher) SaveToken()
- func (d Dispatcher) Score() float64
- func (d *Dispatcher) SetIP(ip string)
- func (d Dispatcher) Solo(jr string) (string, error)
- func (d Dispatcher) Start()
- func (d Dispatcher) Version() (string, error)
- func (d *Dispatcher) WorkerConnect(ctx context.Context, args wamp.List, kwargs, details wamp.Dict) *client.InvokeResult
- func (d Dispatcher) WorkerDisconnect()
- func (d Dispatcher) WorkersCount() int
- func (d Dispatcher) WorkersCountBusy() int
- func (d Dispatcher) WorkersCountNotBusy() int
- func (d Dispatcher) WriteJobsAndPublish(jobs map[string]job.Job)
- type DispatcherBody
- type Version
- type Worker
- func (w Worker) CancelJobSubscription()
- func (w Worker) CancelTopic() string
- func (w *Worker) Connect()
- func (w *Worker) Dial(url string) error
- func (w Worker) Disconnect()
- func (w Worker) GetBusy() bool
- func (w Worker) GetDispatcher() string
- func (w *Worker) GetDispatchers()
- func (w Worker) GetItem() qItem.Item
- func (w Worker) GetPrivByte() []byte
- func (w Worker) GetPrivString() string
- func (w Worker) GetPubByte() []byte
- func (w Worker) GetPubString() string
- func (w Worker) GetShortlist() []string
- func (w Worker) GetState() string
- func (w Worker) GetUptimeString() string
- func (w Worker) GetUptme() int64
- func (w Worker) JobSubscription()
- func (w Worker) JobTopic() string
- func (w Worker) ResultTopic() string
- func (w *Worker) SetBusy(b bool)
- func (w *Worker) SetDispatcher(d string)
- func (w *Worker) SetItem(i qItem.Item)
- func (w *Worker) SetShortlist(s []string)
- func (w *Worker) SetState(s string)
- func (w Worker) Start()
- func (w Worker) WatchInterrupt()
- type WorkerInfo
- func (w *WorkerInfo) Assign(j *qItem.Item)
- func (w *WorkerInfo) Busy() bool
- func (w WorkerInfo) CancelTopic() string
- func (w WorkerInfo) GetJob() *qItem.Item
- func (w WorkerInfo) GetPub() string
- func (w WorkerInfo) GetShut() bool
- func (w WorkerInfo) JobTopic() string
- func (w WorkerInfo) ResultTopic() string
- func (w *WorkerInfo) SetJob(j *qItem.Item)
- func (w *WorkerInfo) SetPub(pub string)
- func (w *WorkerInfo) SetShut(s bool)
- type WorkerPriorityQueue
Constants ¶
const ( //NodeDB file name of nodeinfo database NodeDB = "%s.nodeinfo.db" //NodeBucket bolt db bucket NodeBucket = "node" //MaxWorkers number of workers allowed per standard area MaxWorkers = 128 //DefaultPort default port DefaultPort = 9999 //CentrumURL url of centrum api CentrumURL = "https://centrum-dev.herokuapp.com" //GizoVersion version of gizo GizoVersion = 1 )
const ( // when a node is not connected to the network DOWN = "DOWN" // worker - when a worker connects to a dispatchers standard area // dispatcher - when an adjacency is created and topology table, peer table and blockchain have not been synced INIT = "INIT" // worker - when a node starts receiving and crunching jobs LIVE = "LIVE" // dispatcher - when an adjacency is created and topology table, peer table and blockchain have been sync FULL = "FULL" //CONNFULL when the max number of workers is reached CONNFULL = "CONNFULL" //BLOCK when a block is sent or received BLOCK = "BLOCK" //BLOCKREQ block request channel BLOCKREQ = "BLOCKREQ" //WORKERCONNECT worker connect rpc method name WORKERCONNECT = "WORKERCONNECT" //WORKERDISCONNECT worker disconnect channel WORKERDISCONNECT = "worker.disconnect" //CONNECTED ack message for connection to dispatcher area CONNECTED = "CONNECTED" //WORKERREALM realm worker nodes connect to WORKERREALM = "gizo.network.worker" //DISPATCHERREALM realm dispatcher nodes connect to DISPATCHERREALM = "gizo.network.dispatcher" )
node states
Variables ¶
var ( //ErrNoToken occurs when node has not token ErrNoToken = errors.New("Centrum: No token in struct") //ErrUnableToConnect occurs when node is unable to connect to centrum ErrUnableToConnect = errors.New("Centrum: Unable to connect to centrum") )
var ( //ErrJobsFull occurs when jobs map is full ErrJobsFull = errors.New("Jobs map full") )
var ( //ErrNoDispatchers occurs when there are no dispaters return from centrum ErrNoDispatchers = errors.New("Centrum: no dispatchers available") )
Functions ¶
Types ¶
type Centrum ¶
type Centrum struct {
// contains filtered or unexported fields
}
Centrum communication with centrum
func (Centrum) ConnectWorker ¶
ConnectWorker increments dispatchers worker in centrum
func (Centrum) DisconnectWorker ¶
DisconnectWorker decrements dispatchers worker in centrum
func (Centrum) GetDispatchers ¶
GetDispatchers returns active dispatchers
func (*Centrum) NewDisptcher ¶
NewDisptcher registers dispatcher in centrum
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher dispatcher node
func NewDispatcher ¶
func NewDispatcher(port int) *Dispatcher
NewDispatcher initalizes dispatcher node
func (*Dispatcher) AddJob ¶
func (d *Dispatcher) AddJob(j job.Job)
AddJob keeps job in memory before being written to the bc
func (*Dispatcher) AddPeer ¶
func (d *Dispatcher) AddPeer(p string, c *client.Client)
AddPeer adds peer connection
func (Dispatcher) Batch ¶
func (d Dispatcher) Batch(jrs []string) (string, error)
Batch executes execs in parallel
func (Dispatcher) BlockByHash ¶
func (d Dispatcher) BlockByHash(hash string) (string, error)
BlockByHash returns block of specified hash
func (Dispatcher) BlockByHeight ¶
func (d Dispatcher) BlockByHeight(height int) (string, error)
BlockByHeight returns block at specified height
func (Dispatcher) BlockHashesHex ¶
func (d Dispatcher) BlockHashesHex() ([]string, error)
BlockHashesHex returns hashes of all blocks in the blockchain
func (Dispatcher) BlockReq ¶
func (d Dispatcher) BlockReq(ctx context.Context, args wamp.List, kwargs, details wamp.Dict) *client.InvokeResult
BlockReq handles peer request for block
func (*Dispatcher) BlockSubscribe ¶
func (d *Dispatcher) BlockSubscribe(peer *client.Client)
BlockSubscribe subscribe and publish to block topic
func (Dispatcher) CancelExec ¶
func (d Dispatcher) CancelExec(hash string) error
CancelExec cancels exc
func (Dispatcher) Chain ¶
func (d Dispatcher) Chain(jrs []string) (string, error)
Chain executes execs one after the other (allows multiple jobs and multiple execs)
func (Dispatcher) Chord ¶
func (d Dispatcher) Chord(jrs []string, callbackJr string) (string, error)
Chord executes execs one after the other then passes results into callback exec as a list (allows multiple jobs and multiple execs)
func (*Dispatcher) EmptyJobs ¶
func (d *Dispatcher) EmptyJobs()
EmptyJobs empties the jobs held in memory
func (Dispatcher) ExecArgs ¶
func (d Dispatcher) ExecArgs(id string, hash string) ([]interface{}, error)
ExecArgs returns arguments of an exec
func (Dispatcher) ExecBackoff ¶
func (d Dispatcher) ExecBackoff(id string, hash string) (float64, error)
ExecBackoff returns time between retries of an exec(seconds)
func (Dispatcher) ExecBy ¶
func (d Dispatcher) ExecBy(id string, hash string) (string, error)
ExecBy returns public key of worker that executed the job
func (Dispatcher) ExecDurationMinutes ¶
func (d Dispatcher) ExecDurationMinutes(id string, hash string) (float64, error)
ExecDurationMinutes returns duration of an exec in minutes
func (Dispatcher) ExecDurationNanoseconds ¶
func (d Dispatcher) ExecDurationNanoseconds(id string, hash string) (int64, error)
ExecDurationNanoseconds returns duration of an exec in nanoseconds
func (Dispatcher) ExecDurationSeconds ¶
func (d Dispatcher) ExecDurationSeconds(id string, hash string) (float64, error)
ExecDurationSeconds returns duration of an exec in seconds
func (Dispatcher) ExecDurationString ¶
func (d Dispatcher) ExecDurationString(id string, hash string) (string, error)
ExecDurationString returns duration of an exec as string
func (Dispatcher) ExecErr ¶
func (d Dispatcher) ExecErr(id string, hash string) (interface{}, error)
ExecErr returns error of an exec - None if no error occured
func (Dispatcher) ExecExecutionTime ¶
func (d Dispatcher) ExecExecutionTime(id string, hash string) (int64, error)
ExecExecutionTime returns scheduled time of exec (unix)
func (Dispatcher) ExecExecutionTimeString ¶
func (d Dispatcher) ExecExecutionTimeString(id string, hash string) (string, error)
ExecExecutionTimeString returns scheduled time of exec (string)
func (Dispatcher) ExecInterval ¶
func (d Dispatcher) ExecInterval(id string, hash string) (int, error)
ExecInterval returns time between retries of an exec(seconds)
func (Dispatcher) ExecPriority ¶
func (d Dispatcher) ExecPriority(id string, hash string) (int, error)
ExecPriority returns priority of an exec
func (Dispatcher) ExecResult ¶
func (d Dispatcher) ExecResult(id string, hash string) (interface{}, error)
ExecResult result of an exec - None if error occurs
func (Dispatcher) ExecRetries ¶
func (d Dispatcher) ExecRetries(id string, hash string) (int, error)
ExecRetries returns number of retries attempted by the worker
func (Dispatcher) ExecStatus ¶
func (d Dispatcher) ExecStatus(id string, hash string) (string, error)
ExecStatus returns status of exec
func (Dispatcher) ExecTTLHours ¶
func (d Dispatcher) ExecTTLHours(id string, hash string) (float64, error)
ExecTTLHours returns ttl of exec (hours)
func (Dispatcher) ExecTTLMinutes ¶
func (d Dispatcher) ExecTTLMinutes(id string, hash string) (float64, error)
ExecTTLMinutes ttl of exec (minutes)
func (Dispatcher) ExecTTLNanoseconds ¶
func (d Dispatcher) ExecTTLNanoseconds(id string, hash string) (int64, error)
ExecTTLNanoseconds returns tll of exec (nanoseconds)
func (Dispatcher) ExecTTLSeconds ¶
func (d Dispatcher) ExecTTLSeconds(id string, hash string) (float64, error)
ExecTTLSeconds returns ttl of exec (seconds)
func (Dispatcher) ExecTTLString ¶
func (d Dispatcher) ExecTTLString(id string, hash string) (string, error)
ExecTTLString returns ttl of exec (string)
func (Dispatcher) ExecTimestamp ¶
func (d Dispatcher) ExecTimestamp(id string, hash string) (int64, error)
ExecTimestamp returns timestamp of exec - when the job started running (unix)
func (Dispatcher) ExecTimestampString ¶
func (d Dispatcher) ExecTimestampString(id string, hash string) (string, error)
ExecTimestampString returns timestamp of exec - when the job started running (string)
func (Dispatcher) GetAssignedWorker ¶
func (d Dispatcher) GetAssignedWorker(hash string) string
GetAssignedWorker returns worker assigned to execute job
func (Dispatcher) GetBC ¶
func (d Dispatcher) GetBC() *core.BlockChain
GetBC returns blockchain object
func (Dispatcher) GetBench ¶
func (d Dispatcher) GetBench() benchmark.Engine
GetBench returns node benchmark
func (Dispatcher) GetBenchmarks ¶
func (d Dispatcher) GetBenchmarks() []benchmark.Benchmark
GetBenchmarks return node benchmarks per difficulty
func (*Dispatcher) GetDispatchersAndSync ¶
func (d *Dispatcher) GetDispatchersAndSync()
GetDispatchersAndSync get's dispatchers from centrum and syncs with the node with the highest verison
func (Dispatcher) GetJC ¶
func (d Dispatcher) GetJC() *cache.JobCache
GetJC returns job cache object
func (Dispatcher) GetJobPQ ¶
func (d Dispatcher) GetJobPQ() *queue.JobPriorityQueue
GetJobPQ returns priority of job execs
func (Dispatcher) GetJobs ¶
func (d Dispatcher) GetJobs() map[string]job.Job
GetJobs returns jobs held in memory to be written to the bc
func (Dispatcher) GetPeers ¶
func (d Dispatcher) GetPeers() map[string]*client.Client
GetPeers returns peers
func (Dispatcher) GetPrivByte ¶
func (d Dispatcher) GetPrivByte() []byte
GetPrivByte returns private key of node as bytes
func (Dispatcher) GetPrivString ¶
func (d Dispatcher) GetPrivString() string
GetPrivString returns private key of node as string
func (Dispatcher) GetPubByte ¶
func (d Dispatcher) GetPubByte() []byte
GetPubByte returns public key of node as bytes
func (Dispatcher) GetPubString ¶
func (d Dispatcher) GetPubString() string
GetPubString returns public key of node as bytes
func (Dispatcher) GetRPC ¶
func (d Dispatcher) GetRPC() *rpc.HTTPService
GetRPC returns hprose rpc http server
func (Dispatcher) GetUptime ¶
func (d Dispatcher) GetUptime() int64
GetUptime returns uptime of node
func (Dispatcher) GetUptimeString ¶
func (d Dispatcher) GetUptimeString() string
GetUptimeString returns uptime of node as string
func (Dispatcher) GetWorker ¶
func (d Dispatcher) GetWorker(s string) *WorkerInfo
GetWorker returns specified worker
func (Dispatcher) GetWorkerPQ ¶
func (d Dispatcher) GetWorkerPQ() *WorkerPriorityQueue
GetWorkerPQ returns the workers priotity queue
func (Dispatcher) GetWorkers ¶
func (d Dispatcher) GetWorkers() map[string]*WorkerInfo
GetWorkers returns workers in the standard area
func (Dispatcher) GetWriteQ ¶
func (d Dispatcher) GetWriteQ() *lane.Queue
GetWriteQ returns queue of jobs to be written to the bc
func (Dispatcher) IsJobPrivate ¶
func (d Dispatcher) IsJobPrivate(id string) (bool, error)
IsJobPrivate returns if job is private (true) / public (false)
func (Dispatcher) JobExecs ¶
func (d Dispatcher) JobExecs(id string) (string, error)
JobExecs returns all execs of a job
func (Dispatcher) JobLatestExec ¶
func (d Dispatcher) JobLatestExec(id string) (string, error)
JobLatestExec returns latest exec of job
func (Dispatcher) JobName ¶
func (d Dispatcher) JobName(id string) (string, error)
JobName returns name of job
func (Dispatcher) JobQueueCount ¶
func (d Dispatcher) JobQueueCount() int
JobQueueCount returns nubmer of jobs waiting to be executed
func (Dispatcher) JobSubmisstionTimeString ¶
func (d Dispatcher) JobSubmisstionTimeString(id string) (string, error)
JobSubmisstionTimeString returns submission time of job (string)
func (Dispatcher) JobSubmisstionTimeUnix ¶
func (d Dispatcher) JobSubmisstionTimeUnix(id string) (int64, error)
JobSubmisstionTimeUnix returns submission time of job (unix)
func (Dispatcher) KeyPair ¶
func (d Dispatcher) KeyPair() (string, error)
KeyPair returns new pub and priv keypair
func (Dispatcher) Latest15Blocks ¶
func (d Dispatcher) Latest15Blocks() (string, error)
Latest15Blocks returns array of most recent 15 blocks
func (Dispatcher) LatestBlock ¶
func (d Dispatcher) LatestBlock() (string, error)
LatestBlock returns latest block in the blockchain
func (Dispatcher) LatestBlockHeight ¶
func (d Dispatcher) LatestBlockHeight() (int, error)
LatestBlockHeight height of latest block in the blockchain
func (Dispatcher) NewExec ¶
func (d Dispatcher) NewExec(args []interface{}, retries, priority int, backoff int64, execTime int64, interval int, ttl int64, pub string, envs string) (string, error)
NewExec returns exec with specified config
func (Dispatcher) PeerCount ¶
func (d Dispatcher) PeerCount() int
PeerCount returns the number of peers a node has
func (Dispatcher) PendingCount ¶
func (d Dispatcher) PendingCount() int
PendingCount returns number of jobs waiting to be written to the blockchain
func (Dispatcher) PublicKey ¶
func (d Dispatcher) PublicKey() string
PublicKey returns public key of node
func (Dispatcher) Register ¶
func (d Dispatcher) Register()
Register registers dispatcher with centrum
func (Dispatcher) SaveToken ¶
func (d Dispatcher) SaveToken()
SaveToken saves token got from centrum to db
func (Dispatcher) Solo ¶
func (d Dispatcher) Solo(jr string) (string, error)
Solo executes a single exec
func (Dispatcher) Version ¶
func (d Dispatcher) Version() (string, error)
Version returns dispatcher node's version information
func (*Dispatcher) WorkerConnect ¶
func (d *Dispatcher) WorkerConnect(ctx context.Context, args wamp.List, kwargs, details wamp.Dict) *client.InvokeResult
WorkerConnect handles workers request to join area
func (Dispatcher) WorkerDisconnect ¶
func (d Dispatcher) WorkerDisconnect()
WorkerDisconnect handles worker disconnect
func (Dispatcher) WorkersCount ¶
func (d Dispatcher) WorkersCount() int
WorkersCount returns number of workers in a dispatchers standard area
func (Dispatcher) WorkersCountBusy ¶
func (d Dispatcher) WorkersCountBusy() int
WorkersCountBusy returns number of workers in a dispatchers standard area that are busy
func (Dispatcher) WorkersCountNotBusy ¶
func (d Dispatcher) WorkersCountNotBusy() int
WorkersCountNotBusy returns number of workers in a dispatchers standard area that are not busy
func (Dispatcher) WriteJobsAndPublish ¶
func (d Dispatcher) WriteJobsAndPublish(jobs map[string]job.Job)
WriteJobsAndPublish writes jobs to the bc
type DispatcherBody ¶
DispatcherBody message sent to centrum
type Version ¶
Version used for node synchornization
func NewVersion ¶
NewVersion initializes a version
type Worker ¶
type Worker struct { Pub []byte //public key of the node Dispatcher string // contains filtered or unexported fields }
Worker worker node
func (Worker) CancelJobSubscription ¶
func (w Worker) CancelJobSubscription()
CancelJobSubscription handles cancellation requests
func (Worker) CancelTopic ¶
CancelTopic channel that dispatcher emits cancel req to worker
func (Worker) GetDispatcher ¶
GetDispatcher returns connected dispatcher
func (*Worker) GetDispatchers ¶
func (w *Worker) GetDispatchers()
GetDispatchers connects to centrum to get dispatchers
func (Worker) GetPrivByte ¶
GetPrivByte returns private key as byte
func (Worker) GetPrivString ¶
GetPrivString returns private key as string
func (Worker) GetPubByte ¶
GetPubByte returns public key as bytes
func (Worker) GetPubString ¶
GetPubString returns public key as string
func (Worker) GetUptimeString ¶
GetUptimeString returns uptime as string
func (Worker) JobSubscription ¶
func (w Worker) JobSubscription()
JobSubscription handles job execution
func (Worker) ResultTopic ¶
ResultTopic channel that worker emits result to dispatcher
func (*Worker) SetDispatcher ¶
SetDispatcher sets connected dispatcher
func (*Worker) SetShortlist ¶
SetShortlist sets shortlists
type WorkerInfo ¶
type WorkerInfo struct {
// contains filtered or unexported fields
}
WorkerInfo information about worker
func NewWorkerInfo ¶
func NewWorkerInfo(pub string) *WorkerInfo
NewWorkerInfo initalizes worker info
func (WorkerInfo) CancelTopic ¶
func (w WorkerInfo) CancelTopic() string
CancelTopic channel that dispatcher emits cancel req to worker
func (WorkerInfo) JobTopic ¶
func (w WorkerInfo) JobTopic() string
JobTopic channel that dispatcher emits jobs to worker
func (WorkerInfo) ResultTopic ¶
func (w WorkerInfo) ResultTopic() string
ResultTopic channel that worker emits result to dispatcher
type WorkerPriorityQueue ¶
type WorkerPriorityQueue struct {
// contains filtered or unexported fields
}
WorkerPriorityQueue priotity queue of workers
func NewWorkerPriorityQueue ¶
func NewWorkerPriorityQueue() *WorkerPriorityQueue
NewWorkerPriorityQueue initializes worker priority queue
func (WorkerPriorityQueue) Len ¶
func (pq WorkerPriorityQueue) Len() int
Len returns priority queues length
func (WorkerPriorityQueue) Pop ¶
func (pq WorkerPriorityQueue) Pop() string
Pop returns next worker in the priority queue
func (WorkerPriorityQueue) Push ¶
func (pq WorkerPriorityQueue) Push(s string, priority int)
Push adds worker to the priority queue