Skip to content

Commit be3b43e

Browse files
authored
feat(rst): expand remote storage target support (#50)
* Add JobRequestCfg defining common job request configuration structure including the ability to stub files. * Add JobLockInfo for passing local and remote information collected under a BeeGFS file access lock so they can be reused by subsequent steps to optimize job execution and minimize work done by the Remote service. * Add a BuilderJob type to support walking paths and generating job requests for each file or object. This allows downloading multiple files/objects at once. * Add a job request GenerationStatus used to handle failed preconditions that prevent a job from being generated, or communicate if there is an existing job already in a terminal or failed state that prevents generating a new job.
1 parent f07d1e5 commit be3b43e

File tree

12 files changed

+12243
-4389
lines changed

12 files changed

+12243
-4389
lines changed

cpp/beeremote.pb.cc

Lines changed: 686 additions & 206 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpp/beeremote.pb.h

Lines changed: 1575 additions & 978 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpp/flex.pb.cc

Lines changed: 2300 additions & 421 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpp/flex.pb.h

Lines changed: 4076 additions & 1593 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/beeremote/beeremote.pb.go

Lines changed: 579 additions & 305 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/beeremote/beeremote_protoopaque.pb.go

Lines changed: 578 additions & 309 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/flex/flex.pb.go

Lines changed: 1091 additions & 282 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/flex/flex_protoopaque.pb.go

Lines changed: 1082 additions & 286 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/beeremote.proto

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ message SubmitJobResponse {
3737
CREATED = 1;
3838
EXISTING = 2;
3939
NOT_ALLOWED = 3;
40+
ALREADY_COMPLETE = 4;
41+
ALREADY_OFFLOADED = 5;
42+
FAILED_PRECONDITION = 6;
4043
}
4144
}
4245

@@ -58,12 +61,40 @@ message JobRequest {
5861
oneof type {
5962
flex.SyncJob sync = 10;
6063
flex.MockJob mock = 11;
64+
flex.BuilderJob builder = 12;
6165
}
6266
// When force is set this request will create a new job even if there is already a completed
6367
// job. When forced the request will return an error if there is already a job running. This is
6468
// part of the JobRequest instead of the SubmitJobRequest message in case it ever is important
6569
// to know if a particular job request was forced.
66-
bool force = 5;
70+
bool force = 5;
71+
// When stub_local is set the local file with be a stub file
72+
bool stub_local = 7;
73+
// generation_status reports the outcome of generating this JobRequest (e.g. already complete,
74+
// already offloaded, or an error message). This is used by job manager to determine whether the
75+
// job is already in a terminal or failed state.
76+
GenerationStatus generation_status = 8;
77+
message GenerationStatus {
78+
State state = 1;
79+
enum State {
80+
// This state has no semantic value and should never be UNSPECIFIED unless there is a bug.
81+
UNSPECIFIED = 0;
82+
// This state indicates the request has already been completed. The generation_status's
83+
// message field must be populated with the file's beegfs-mtime in RFC3339 format (i.e.
84+
// 2006-01-02T15:04:05Z07:00).
85+
ALREADY_COMPLETE = 1;
86+
// This state indicates the request has already been offloaded.
87+
ALREADY_OFFLOADED = 2;
88+
// This state indicates a preconditional failed and will always result in the job being
89+
// cancelled. It is imperative that this state is only used when it is safe to submit
90+
// the job request again without first calling rst.CompleteWorkRequests().
91+
FAILED_PRECONDITION = 3;
92+
// This state indicates an error occurred that requires rst.CompleteWorkRequests() to
93+
// cleanup.
94+
ERROR = 4;
95+
}
96+
string message = 2;
97+
}
6798
}
6899

69100
// Job contains all the data from the original request plus the job ID and
@@ -146,6 +177,9 @@ message Job {
146177
// If the job and its WRs completed successfully. This is a terminal state and no further
147178
// state changes are possible once a job enters this state.
148179
COMPLETED = 9;
180+
// If the job's WRs completed successfully and a stub has replaced the local file. This is a
181+
// terminal state and no further state changes are possible once a job enters this state.
182+
OFFLOADED = 10;
149183
}
150184
// Used as the upload ID for multipart uploads, or any other time
151185
// an external identifer is needed to coordinate a distributed transfer.

proto/flex.proto

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,57 @@ message BulkUpdateWorkResponse {
8282
string message = 2;
8383
}
8484

85+
// JobLockedInfo contains require information that must be determined prior to calling a job request for
86+
// file. This will be produced by sync's job builder but can be produced anywhere it makes sense such as
87+
// in ctl.
88+
message JobLockedInfo {
89+
// Indicates the file write lock has already been obtained.
90+
bool write_locked = 1;
91+
// Whether the local file exists.
92+
bool exists = 2;
93+
// Size of the local file.
94+
int64 size = 3;
95+
// File mode of the local file
96+
uint32 mode = 4;
97+
// Last modified time of the local file.
98+
google.protobuf.Timestamp mtime = 5;
99+
// Size of the remote file or object.
100+
int64 remote_size = 6;
101+
// Last beegfs_mtime of the remote file or object.
102+
google.protobuf.Timestamp remote_mtime = 7;
103+
// If stub_url is not empty then path is for a stub file with the provided rst url.
104+
uint32 stub_url_rst_id = 8;
105+
string stub_url_path = 9;
106+
string externalId = 10;
107+
}
108+
109+
message JobRequestCfg {
110+
uint32 remoteStorageTarget = 1;
111+
string path = 2;
112+
string remotePath = 3;
113+
bool download = 4;
114+
bool stub_local = 5;
115+
bool overwrite = 6;
116+
bool flatten = 7;
117+
bool force = 8;
118+
JobLockedInfo locked_info = 9;
119+
}
120+
85121
// BeeRemote assigns work for a job to one or more worker nodes.
86122
message WorkRequest {
87123
string job_id = 1;
88124
string request_id = 2;
89125
// Used as the upload ID for multipart uploads, or any other time
90-
// an external identifer is needed to coordinate a distributed transfer.
126+
// an external identifier is needed to coordinate a distributed transfer.
91127
string external_id = 3;
92128
string path = 4;
93129
Segment segment = 5;
94130
uint32 remote_storage_target = 6;
95131
oneof Type {
96132
MockJob mock = 10;
97133
SyncJob sync = 11;
134+
BuilderJob builder = 12;
98135
}
99-
100136
// A segment indicates what portion of the file a particular worker node should
101137
// work on. Segments can be divided into one or more parts, which can be used to
102138
// execute the requested operation in parallel if supported by the RST type.
@@ -109,15 +145,22 @@ message WorkRequest {
109145
// Inclusive of the last part.
110146
int32 parts_stop = 4;
111147
}
148+
// When stub_local is set the local file with be a stub file
149+
bool stub_local = 8;
150+
}
112151

152+
// JobBuilderJob is a special type of job that creates job requests of any time.
153+
message BuilderJob {
154+
JobRequestCfg cfg = 1;
113155
}
114156

115157
message MockJob {
116158
int32 num_test_segments = 1;
117159
int64 file_size = 2;
118160
string external_id = 3;
119161
bool should_fail = 4;
120-
bool can_retry = 5;
162+
JobLockedInfo locked_info = 6;
163+
JobRequestCfg cfg = 7;
121164
}
122165

123166
// A SyncJob is WHAT work needs to be done. It is populated based on the
@@ -140,6 +183,10 @@ message SyncJob {
140183
// for example to restore a file in an RST to a different location in BeeGFS. This currently is
141184
// ignored for uploads.
142185
string remote_path = 3;
186+
// By default the remote directory structure will be preserved on downloads unless flatten is
187+
// set. If the flag is set then the directory delimiter will be replaced with an underscore.
188+
bool flatten = 5;
189+
JobLockedInfo locked_info = 6;
143190
}
144191

145192
// Currently while requests types are specific to a particular worker node type,
@@ -226,6 +273,8 @@ message Work {
226273
string checksum_sha256 = 5;
227274
bool completed = 6;
228275
}
276+
// Indicates whether the work is a job builder task.
277+
bool job_builder = 6;
229278
}
230279

231280
// We use a common configuration update request/response types for all worker
@@ -256,6 +305,12 @@ message UpdateConfigResponse {
256305
message BeeRemoteNode {
257306
string id = 1;
258307
string address = 2;
308+
string mgmtd_address = 3;
309+
bytes mgmtd_tls_cert = 4;
310+
bool mgmtd_tls_disable_verification = 5;
311+
bool mgmtd_tls_disable = 6;
312+
bytes auth_secret = 7;
313+
bool auth_disable = 8;
259314
}
260315

261316
// Remote Storage Targets (RSTs) describe where data should be stored or

0 commit comments

Comments
 (0)