forked from F1bonacc1/process-compose
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject_interface.go
More file actions
59 lines (55 loc) · 2.74 KB
/
Copy pathproject_interface.go
File metadata and controls
59 lines (55 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package app
import (
"github.com/f1bonacc1/process-compose/src/pclog"
"github.com/f1bonacc1/process-compose/src/types"
)
// IProject holds all the functions from the project struct that are being consumed by the tui package
type IProject interface {
ShutDownProject() error
IsRemote() bool
ErrorForSecs() int
GetProjectName() (string, error)
GetProjectState(checkMem bool) (*types.ProjectState, error)
GetLogLength() int
GetLogsAndSubscribe(name string, observer pclog.LogObserver) error
UnSubscribeLogger(name string, observer pclog.LogObserver) error
GetProcessLog(name string, offsetFromEnd, limit int) ([]string, error)
GetLexicographicProcessNames() ([]string, error)
GetProcessInfo(name string) (*types.ProcessConfig, error)
GetProcessState(name string) (*types.ProcessState, error)
GetProcessesState() (*types.ProcessesState, error)
StopProcess(name string) error
// Always returns non nil(so possibly empty) map.
// Value in map is `ok` on success, else on error to stop specific process.
// Iterates all processes (best effort).
// If all proceses were stopped, error is nil.
StopProcesses(names []string) (map[string]string, error)
// StopNamespace stops all processes in the given namespace.
// Returns a map of process name -> result ("ok" or error string).
// If namespace has no processes, returns ErrNamespaceNotFound.
StopNamespace(name string) (map[string]string, error)
// DisableNamespace disables all processes in the given namespace.
// Returns a map of process name -> result ("ok" or error string).
// If namespace has no processes, returns ErrNamespaceNotFound.
DisableNamespace(name string) (map[string]string, error)
// EnableNamespace enables all processes in the given namespace.
// Returns a map of process name -> result ("ok" or error string).
// If namespace has no processes, returns ErrNamespaceNotFound.
EnableNamespace(name string) (map[string]string, error)
StartProcess(name string) error
RestartProcess(name string) error
ScaleProcess(name string, scale int) error
GetProcessPorts(name string) (*types.ProcessPorts, error)
SetProcessPassword(name string, password string) error
UpdateProject(project *types.Project) (map[string]string, error)
UpdateProcess(updated *types.ProcessConfig) error
ReloadProject() (map[string]string, error)
TruncateProcessLogs(name string) error
// Updates project config for provided processes.
// Processes may belong to different namespaces.
// Works as `UpdateProcess` for each process or like `UpdateProject`(only modify and add changes, not removal).
UpdateProcesses(processes *types.Processes) (map[string]string, error)
// Updates project config by removing processes.
// If namespace does not exist, success returned.
RemoveNamespace(name string) (map[string]string, error)
}