Documentation ¶
Index ¶
- func New(na *NewAssignment, a *Assignment) *assignment
- type Asgn
- type Assignment
- type Assignments
- type EmptyAssignment
- type InvalidVerificationType
- type JobEmptyAssignment
- type JobEmptyAssignments
- type NewAssignment
- type NewVerificationResponse
- type Params
- type Settings
- type Status
- type TaskResponse
- type TaskResponses
- type VerificationResponse
- type VerificationResponses
- type Whitelist
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(na *NewAssignment, a *Assignment) *assignment
Types ¶
type Asgn ¶
type Asgn interface { IsAllowed(set *Settings) (bool, error) GetAssignment() *Assignment GetNewAssignment() *NewAssignment }
type Assignment ¶
type Assignment struct { ID uint64 `db:"id" json:"id"` JobID uint64 `db:"job_id" json:"job_id"` TaskID uint64 `db:"task_id" json:"task_id"` WorkerID uint64 `db:"worker_id" json:"worker_id"` VerifierID nulls.Int64 `db:"verifier_id" json:"verifier_id"` ResponseID nulls.Int64 `db:"response_id" json:"response_id"` Active nulls.Bool `db:"active" json:"active"` Status Status `db:"status" json:"status"` AssignedAt time.Time `db:"assigned_at" json:"assigned_at"` ExpiresAt nulls.Time `db:"expires_at" json:"expires_at"` }
type Assignments ¶
type Assignments []Assignment
type EmptyAssignment ¶
type InvalidVerificationType ¶
type InvalidVerificationType struct {
Manual bool
}
func (InvalidVerificationType) Error ¶
func (err InvalidVerificationType) Error() string
type JobEmptyAssignment ¶
type JobEmptyAssignments ¶
type JobEmptyAssignments []JobEmptyAssignment
func (JobEmptyAssignments) Filter ¶
func (js JobEmptyAssignments) Filter(cond func(JobEmptyAssignment) bool) JobEmptyAssignments
func (JobEmptyAssignments) JobIDs ¶
func (jes JobEmptyAssignments) JobIDs() []uint64
type NewAssignment ¶
type NewVerificationResponse ¶
type NewVerificationResponse struct { JobID uint64 `json:"job_id"` TaskID uint64 `json:"task_id"` ResponseID uint64 `json:"response_id"` WorkerID uint64 `json:"worker_id"` VerifierID int64 `json:"verifier_id"` Accepted bool `json:"accepted"` Reason nulls.String `json:"reason"` }
NewVerificationResponse entity (params)
func (NewVerificationResponse) ToVerificationResponse ¶
func (n NewVerificationResponse) ToVerificationResponse() VerificationResponse
type Params ¶
type Params struct { WorkerID string VerifierID string JobID string TaskID string ResponseID string Status Status }
Params for querying responses
func (Params) ToQueryCondition ¶
ToQueryCondition converts Params to sql query condition
type Settings ¶
type Settings struct { ID uint64 `json:"id" db:"id"` JobID uint64 `json:"job_id" db:"job_id"` Manual bool `json:"manual" db:"manual"` // verification can be automatic or manual Requester bool `json:"requester" db:"requester"` // manual (assign): requester only Limit int `json:"limit" db:"limit"` // manual (assign): total assignment limit per job per worker Whitelist bool `json:"whitelist" db:"whitelist"` // manual (assign): a whitelist for workers AgreementCount nulls.Int64 `json:"agreement_count" db:"agreement_count"` // automatic (verify): agreeement count }
Settings for job verification
type TaskResponse ¶
type TaskResponse struct { ID uint64 `json:"id"` JobID uint64 `json:"job_id"` TaskID uint64 `json:"task_id"` WorkerID uint64 `json:"worker_id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Value json.RawMessage `json:"value"` }
TaskResponse entity (params)
type TaskResponses ¶
type TaskResponses []TaskResponse
func (TaskResponses) Has ¶
func (rs TaskResponses) Has(resp TaskResponse) bool
type VerificationResponse ¶
type VerificationResponse struct { ID uint64 `db:"id" json:"id"` JobID uint64 `db:"job_id" json:"job_id"` TaskID uint64 `db:"task_id" json:"task_id"` ResponseID uint64 `db:"response_id" json:"response_id"` WorkerID uint64 `db:"worker_id" json:"worker_id"` VerifierID nulls.Int64 `db:"verifier_id" json:"verifier_id"` Accepted bool `db:"accepted" json:"accepted"` Reason nulls.String `db:"reason" json:"reason"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` }
VerificationResponse onse entity
type VerificationResponses ¶
type VerificationResponses []VerificationResponse
VerificationResponses list
Click to show internal directories.
Click to hide internal directories.