verification

package
v0.0.0-...-28abc36 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

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 EmptyAssignment struct {
	JobID      uint64 `json:"job_id"`
	WorkerID   uint64 `json:"worker_id"`
	TaskID     uint64 `json:"task_id"`
	ResponseID uint64 `json:"response_id"`
}

type InvalidVerificationType

type InvalidVerificationType struct {
	Manual bool
}

func (InvalidVerificationType) Error

func (err InvalidVerificationType) Error() string

type JobEmptyAssignment

type JobEmptyAssignment struct {
	JobID          uint64 `db:"job_id" json:"job_id"`
	AvailableCount uint64 `db:"empty_count" json:"empty_count"`
}

type JobEmptyAssignments

type JobEmptyAssignments []JobEmptyAssignment

func (JobEmptyAssignments) Filter

func (JobEmptyAssignments) JobIDs

func (jes JobEmptyAssignments) JobIDs() []uint64

type NewAssignment

type NewAssignment struct {
	JobID      uint64 `json:"job_id"`
	TaskID     uint64 `json:"task_id"`
	VerifierID uint64 `json:"verifier_id"`
}

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

func (p Params) ToQueryCondition() (string, []interface{})

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 Status

type Status string
const (
	Active   Status = "active"
	InActive Status = "inactive"
	Pending  Status = "pending"
	Accepted Status = "accepted"
	Rejected Status = "rejected"
	Expired  Status = "expired"
)

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

type Whitelist

type Whitelist struct {
	ID         uint64 `db:"id"`
	JobID      uint64 `db:"job_id"`
	VerifierID uint64 `db:"verifier_id"`
}

Whitelist for manual verification

Jump to

Keyboard shortcuts

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