github.com/gitbundle/modules@v0.0.0-20231025071548-85b91c5c3b01/process/process.go (about) 1 // Copyright 2023 The GitBundle Inc. All rights reserved. 2 // Copyright 2017 The Gitea Authors. All rights reserved. 3 // Use of this source code is governed by a MIT-style 4 // license that can be found in the LICENSE file. 5 6 package process 7 8 import ( 9 "context" 10 "time" 11 ) 12 13 var ( 14 SystemProcessType = "system" 15 RequestProcessType = "request" 16 NormalProcessType = "normal" 17 NoneProcessType = "none" 18 ) 19 20 // process represents a working process inheriting from GitBundle. 21 type process struct { 22 PID IDType // Process ID, not system one. 23 ParentPID IDType 24 Description string 25 Start time.Time 26 Cancel context.CancelFunc 27 Type string 28 } 29 30 // ToProcess converts a process to a externally usable Process 31 func (p *process) toProcess() *Process { 32 process := &Process{ 33 PID: p.PID, 34 ParentPID: p.ParentPID, 35 Description: p.Description, 36 Start: p.Start, 37 Type: p.Type, 38 } 39 return process 40 }