-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathdaemon.proto
155 lines (116 loc) · 5.91 KB
/
daemon.proto
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
syntax = "proto3";
package wsdaemon;
option go_package = "github.com/gitpod-io/gitpod/ws-daemon/api";
import "content-service-api/initializer.proto";
service WorkspaceContentService {
// initWorkspace intialises a new workspace folder in the working area
rpc InitWorkspace(InitWorkspaceRequest) returns (InitWorkspaceResponse) {}
// WaitForInit waits until a workspace is fully initialized.
// If the workspace is already initialized, this function returns immediately.
// If there is no initialization is going on, an error is returned.
rpc WaitForInit(WaitForInitRequest) returns (WaitForInitResponse) {}
// IsWorkspaceExists checks if ws-daemon knows about workspace.
rpc IsWorkspaceExists(IsWorkspaceExistsRequest) returns (IsWorkspaceExistsResponse) {}
// TakeSnapshot creates a backup/snapshot of a workspace
rpc TakeSnapshot(TakeSnapshotRequest) returns (TakeSnapshotResponse) {}
// disposeWorkspace cleans up a workspace, possibly after taking a final backup
rpc DisposeWorkspace(DisposeWorkspaceRequest) returns (DisposeWorkspaceResponse) {}
// BackupWorkspace creates a backup of a workspace
rpc BackupWorkspace(BackupWorkspaceRequest) returns (BackupWorkspaceResponse) {}
}
// InitWorkspaceRequest intialises a new workspace folder in the working area
message InitWorkspaceRequest {
// ID is a unique identifier of this workspace. No other workspace with the same name must exist in the realm of this daemon
string id = 1;
// Metadata is data associated with this workspace that's required for other parts of Gitpod to function
WorkspaceMetadata metadata = 2;
// Initializer specifies how the workspace is to be initialized
contentservice.WorkspaceInitializer initializer = 3;
// full_workspace_backup means we ignore the initializer and wait for a workspace pod with the given instance ID to
// appear at our local containerd.
reserved 4;
// content_manifest describes the layers that comprise the workspace image content.
// This manifest is not used to actually download content, but to produce a new manifest for snapshots and backups.
// This field is ignored if full_workspace_backup is false.
reserved 5;
// Was used for user_namespaced
reserved 6;
// remote_storage_disabled disables any support for remote storage operations, specifically backups and snapshots.
// When any such operation is attempted, a FAILED_PRECONDITION error will be the result.
bool remote_storage_disabled = 7;
// storage_quota_bytes enforces a storage quate for the workspace if set to a value != 0
int64 storage_quota_bytes = 8;
// persistent_volume_claim means that we use PVC instead of HostPath to mount /workspace folder and content-init
// happens inside workspacekit instead of in ws-daemon. We also use k8s Snapshots to store\restore workspace content
// instead of GCS\tar.
reserved 9;
}
// WorkspaceMetadata is data associated with a workspace that's required for other parts of the system to function
message WorkspaceMetadata {
// owner is the ID of the Gitpod user to whom we'll bill this workspace and who we consider responsible for its content
string owner = 1;
// meta_id is the workspace ID of this currently running workspace instance on the "meta pool" side
string meta_id = 2;
}
message InitWorkspaceResponse {}
// WaitForInitRequest waits for a workspace to be initialized
message WaitForInitRequest {
// ID is a unique identifier of the workspace
string id = 1;
}
message WaitForInitResponse {}
message IsWorkspaceExistsRequest {
// ID is a unique identifier of the workspace
string id = 1;
}
message IsWorkspaceExistsResponse {
// exists indicates if ws-daemon knows about this workspace or not
bool exists = 1;
}
// TakeSnapshotRequest creates a backup/snapshot of a workspace
message TakeSnapshotRequest {
// ID is the identifier of the workspace of which we want to create a snapshot of
string id = 1;
// return_immediately means we're not waiting until the snapshot is done but return immediately after starting it
bool return_immediately = 2;
}
message TakeSnapshotResponse {
// url is the name of the resulting snapshot
string url = 1;
}
// WorkspaceContentState describes the availability and reliability of the workspace content
enum WorkspaceContentState {
// NONE means that there currently is no workspace content and no work is underway to change that.
NONE = 0;
// SETTING_UP indicates that the workspace content is currently being produced/checked out/unarchived and is
// very likely to change. In this state one must not modify or rely on the workspace content.
SETTING_UP = 1;
// AVAILABLE indicates that the workspace content is fully present and ready for use.
AVAILABLE = 2;
// WRAPPING_UP means that the workspace is being torn down, i.e. a final backup is being produced and the content
// is deleted locally. In this state one must not modify or rely on the workspace content.
WRAPPING_UP = 3;
}
message DisposeWorkspaceRequest {
// ID is a unique identifier of the workspace to dispose of
string id = 1;
// Backup triggers a final backup prior to disposal
bool backup = 2;
// backup_logs triggers the upload of terminal logs
bool backup_logs = 3;
}
message DisposeWorkspaceResponse {
// git_status is the current state of the Git repo in this workspace prior to disposal.
// If the workspace has no Git repo at its checkout location, this is nil.
contentservice.GitStatus git_status = 1;
}
// BackupWorkspaceRequest creates a backup of a workspace
// TODO(rl): do we need an optional bool 'backup_logs' to capture the logs as well?
message BackupWorkspaceRequest {
// ID is the identifier of the workspace of which we want to create a backup of
string id = 1;
}
message BackupWorkspaceResponse {
// url is the name of the resulting backup
string url = 1;
}