Documentation ¶
Index ¶
- Variables
- type Job
- type JobSignConfig
- type Queue
- func (q *Queue) AddBatchPersistentTasks(unitName, jobID string, fileNames map[string]string, ...) error
- func (q *Queue) AddSignJob(signConfig JobSignConfig) string
- func (q *Queue) AddSignUnit(unitName string, signData signer.SignData)
- func (q *Queue) AddTask(unitName, jobID, originalFileName, inputFilePath, outputFilePath string, ...) (string, error)
- func (q *Queue) AddVerifyJob() string
- func (q *Queue) AddVerifyUnit()
- func (q *Queue) DeleteFromDB(jobID string) error
- func (q *Queue) DeleteJob(jobID string) error
- func (q *Queue) GetCompletedTask(jobID, taskID string) (Task, error)
- func (q *Queue) GetJobByID(jobID string) (Job, error)
- func (q *Queue) GetQueueSizeByUnitName(signerName string) (priority_queue.LenAll, error)
- func (q *Queue) LoadFromDB() error
- func (q *Queue) SaveToDB(jobID string) error
- func (q *Queue) StartProcessor()
- type Task
Constants ¶
This section is empty.
Variables ¶
var ( // StatusPending represents StatusPending = "Pending" // StatusFailed is a failed status StatusFailed = "Failed" // StatusCompleted is a completed status StatusCompleted = "Completed" // VerificationUnitName represents a task that should not be signed but verified VerificationUnitName = "VerificationUnitName" )
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct { // ID represents id of the job ID string `json:"id"` // TasksMap represents tasks added to the job TasksMap map[string]Task `json:"task_map"` // totalProcessedTasks represents total processed tasks of the job, incremented atomically TotalProcesedTasks uint32 `json:"total_procesed_tasks"` // JobSignConfig represents additional sign data added by request to override signer initial sign data SignConfig JobSignConfig `json:"sign_data"` }
Job represents a job for sign queue, stores tasks and sign data to override units initial sign data
type JobSignConfig ¶
type JobSignConfig struct { // sign data Signer string `json:"signer"` Name string `json:"name"` Location string `json:"location"` Reason string `json:"reason"` ContactInfo string `json:"contact_info"` CertType uint `json:"cert_type"` DocMDPPerms uint `json:"doc_mdp_perms"` // ValidateSignature allows to verify the job after it's being singed ValidateSignature bool `json:"verify_after_sign"` }
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents sign queue
func (*Queue) AddBatchPersistentTasks ¶
func (*Queue) AddSignJob ¶
func (q *Queue) AddSignJob(signConfig JobSignConfig) string
AddSignJob adds sign job to the jobs map
func (*Queue) AddSignUnit ¶
AddSignUnit adds signer unit to units map
func (*Queue) AddTask ¶
func (q *Queue) AddTask(unitName, jobID, originalFileName, inputFilePath, outputFilePath string, priority priority_queue.Priority) (string, error)
AddTask adds task to the specific job by job id
func (*Queue) AddVerifyJob ¶
AddVerifyJob adds sign job to the jobs map
func (*Queue) AddVerifyUnit ¶
func (q *Queue) AddVerifyUnit()
AddVerifyUnit adds verify unit to units map
func (*Queue) DeleteFromDB ¶
func (*Queue) GetCompletedTask ¶
GetCompletedTask returns the file path if the task is completed
func (*Queue) GetQueueSizeByUnitName ¶
func (q *Queue) GetQueueSizeByUnitName(signerName string) (priority_queue.LenAll, error)
GetQueueSizeByUnitName returns lengths of the channels of all the priorities for the specific signer.
func (*Queue) LoadFromDB ¶
func (*Queue) StartProcessor ¶
func (q *Queue) StartProcessor()
StartProcessor starts separate go routine for each signer which signs associated job tasks when they appear
type Task ¶
type Task struct { // ID represents id of the task ID string `json:"id"` // JobID represents id of the job task is assigned to JobID string `json:"job_id"` // OriginalFileName represents pdf file name OriginalFileName string `json:"original_file_name"` // InputFilePath represents path to the unprocessed file InputFilePath string `json:"input_file_path"` // OutputFilePath represents path to the processed file OutputFilePath string `json:"output_file_path"` // Status represents the status of the task. Pending, Failed, Completed. Status string `json:"status"` // VerificationData represents data of the verification VerificationData *verify.Response `json:"verification_data,omitempty"` // Error represents error if the task failed Error string `json:"error,omitempty"` }
Task represents a single unit of work(file)