domain

package
v0.0.0-...-eac4ed7 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	ID          int
	Created     time.Time
	Priority    Priority
	Tasks       []int
	CurrentTask int
}

Job はジョブを表す構造体です。

func (*Job) AlreadyCompleted

func (j *Job) AlreadyCompleted() bool

AlreadyCompleted はすべてのタスクが完了しているかを bool で返す関数です。

func (*Job) Work

func (j *Job) Work() (point int, done bool)

Work はジョブを実行し、現在のタスクのポイントを返します。丁度タスクが完了したときは done を trueにします。

type JobNotFoundError

type JobNotFoundError struct {
}

func (*JobNotFoundError) Error

func (e *JobNotFoundError) Error() string

type JobPriorityQueue

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

func NewJobPriorityQueue

func NewJobPriorityQueue() *JobPriorityQueue

func (JobPriorityQueue) Len

func (pq JobPriorityQueue) Len() int

func (JobPriorityQueue) Less

func (pq JobPriorityQueue) Less(i, j int) bool

func (*JobPriorityQueue) Pop

func (pq *JobPriorityQueue) Pop() interface{}

func (*JobPriorityQueue) Push

func (pq *JobPriorityQueue) Push(val interface{})

func (*JobPriorityQueue) SetUnusedCap

func (pq *JobPriorityQueue) SetUnusedCap(unusedCap int)

func (JobPriorityQueue) Swap

func (pq JobPriorityQueue) Swap(i, j int)

type Priority

type Priority int
const (
	Low Priority = iota
	High
)

優先度を Enum のように扱えるように定数を宣言

type Worker

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

func NewWorker

func NewWorker(cap int) *Worker

func (*Worker) AddJob

func (w *Worker) AddJob(j *Job)

AddJob はジョブを実行中かキューに追加する関数です。

func (*Worker) CurrentPoint

func (w *Worker) CurrentPoint() int

func (*Worker) ExecuteAllJob

func (w *Worker) ExecuteAllJob(secs int) int

ExecuteAllJob は実行できるすべてのジョブを与えられた秒数だけ実行します。

func (*Worker) NumOfJob

func (w *Worker) NumOfJob() int

Jump to

Keyboard shortcuts

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