Documentation ¶
Index ¶
Constants ¶
View Source
const ( FreelancerGopherIdleState string = "idle" FreelancerGopherWorkingState string = "working" FreelancerGopherToBeFiredState string = "to_be_fired" // CSS에서 바로 이용하기위해 _ case FreelancerGopherFiredState string = "fired" IdleTimeout time.Duration = time.Second * 1 // idle timeout 을 넘어서도 idle하면 짤림. BaseTaskDuration time.Duration = time.Millisecond * 3000 RandomTaskBlock = 3 )
View Source
const ( // 해고 작업 시작 후 마치기까지 걸리는 시간 // to_be_fired => fired로 처리되는데에 걸리는 시간. FireDuration = time.Nanosecond * 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FreelancerGopher ¶
type FreelancerGopher struct { context.Context ID int Name string Office *Office `json:"-"` State string TasksDone int CurrentTask *Task WorkingHour time.Duration `json:"-"` WorkingHourString string `json:"WorkingHour"` TasksOut <-chan Task `json:"-"` // 채널은 json으로 직렬화될 수 없음. Mutex *sync.Mutex // 아직 용도는 안 정해졌음 IdleSign chan<- bool `json:"-"` // Office에게 내가 idle하다고 신호. }
func (*FreelancerGopher) HandleTask ¶
func (freelancer *FreelancerGopher) HandleTask(task Task)
a freelancer keeps working
func (*FreelancerGopher) Start ¶
func (freelancer *FreelancerGopher) Start()
a freelancer gopher is hired by you Start가 끝난다는 것은 더 이상 이 프리랜서는 일을 하지 못한다는 것이다.
type Office ¶
type Office struct { Freelancers []*FreelancerGopher Tasks chan Task FreelancerStateReports chan FreelancerGopher // 개별 freelancer의 상태에 대한 보고서 FreelancerFireReports chan FreelancerGopher // 인사팀의 freelancer 해고에 대한 보고서 HRMutex *sync.Mutex // 인사팀의 Freelancer 해고 작업이 한 명씩 이루어지도록 하기위한 Mutex Lock MiniFreelancer int // 어떻게 구현하지..? }
var MainOffice *Office
func (*Office) HireFreelancer ¶
func (office *Office) HireFreelancer()
func (*Office) HireFreelancers ¶
Click to show internal directories.
Click to hide internal directories.