code.gitea.io/gitea@v1.19.3/modules/process/process.go (about) 1 // Copyright 2021 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package process 5 6 import ( 7 "context" 8 "time" 9 ) 10 11 var ( 12 SystemProcessType = "system" 13 RequestProcessType = "request" 14 NormalProcessType = "normal" 15 NoneProcessType = "none" 16 ) 17 18 // process represents a working process inheriting from Gitea. 19 type process struct { 20 PID IDType // Process ID, not system one. 21 ParentPID IDType 22 Description string 23 Start time.Time 24 Cancel context.CancelFunc 25 Type string 26 } 27 28 // ToProcess converts a process to a externally usable Process 29 func (p *process) toProcess() *Process { 30 process := &Process{ 31 PID: p.PID, 32 ParentPID: p.ParentPID, 33 Description: p.Description, 34 Start: p.Start, 35 Type: p.Type, 36 } 37 return process 38 }