13
13
#ifndef LLBUILD3_SWIFTADAPTORS_H
14
14
#define LLBUILD3_SWIFTADAPTORS_H
15
15
16
+ #include < cstdint>
16
17
#include < functional>
17
18
#include < memory>
18
19
#include < optional>
@@ -38,6 +39,7 @@ typedef std::string CacheValuePB;
38
39
typedef std::string CASIDBytes;
39
40
typedef std::string CASObjectPB;
40
41
typedef std::string ErrorPB;
42
+ typedef std::string FileObjectPB;
41
43
typedef std::string LabelPB;
42
44
typedef std::string SignaturePB;
43
45
typedef std::string TaskContextPB;
@@ -57,7 +59,7 @@ typedef std::shared_ptr<CASDatabase> CASDatabaseRef;
57
59
struct ExtCASDatabase {
58
60
void * ctx;
59
61
60
- // FIXME: cleanup context
62
+ void (*releaseFn)( void * ctx);
61
63
62
64
void (*containsFn)(void * ctx, CASIDBytes id, std::function<void (bool , ErrorPB)>);
63
65
void (*getFn)(void * ctx, CASIDBytes id, std::function<void (CASObjectPB, ErrorPB)>);
@@ -173,9 +175,38 @@ typedef std::shared_ptr<ActionCache> ActionCacheRef;
173
175
LLBUILD3_EXPORT ActionCacheRef makeExtActionCache (ExtActionCache extCache);
174
176
LLBUILD3_EXPORT ActionCacheRef makeInMemoryActionCache ();
175
177
178
+
179
+ struct ExtLocalSandbox {
180
+ void * ctx;
181
+
182
+ void (*releaseFn)(void * ctx);
183
+
184
+ void (*dirFn)(void * ctx, std::string*);
185
+ void (*prepareInputFn)(void * ctx, std::string* path, int type, CASIDBytes* id, ErrorPB*);
186
+ void (*collectOutputsFn)(void *, std::vector<std::string>, std::vector<FileObjectPB>*, ErrorPB*);
187
+ void (*releaseSandboxFn)(void * ctx);
188
+ };
189
+
190
+ struct ExtLocalSandboxProvider {
191
+ void * ctx;
192
+
193
+ void (*releaseFn)(void * ctx);
194
+
195
+ ExtLocalSandbox (*createFn)(void * ctx, uint64_t handle, ErrorPB*);
196
+ };
197
+
176
198
class ActionExecutor ;
199
+ class LocalExecutor ;
200
+ class LocalSandboxProvider ;
201
+ class RemoteExecutor ;
177
202
typedef std::shared_ptr<ActionExecutor> ActionExecutorRef;
178
- LLBUILD3_EXPORT ActionExecutorRef makeActionExecutor ();
203
+ typedef std::shared_ptr<LocalExecutor> LocalExecutorRef;
204
+ typedef std::shared_ptr<LocalSandboxProvider> LocalSandboxProviderRef;
205
+ typedef std::shared_ptr<RemoteExecutor> RemoteExecutorRef;
206
+ LLBUILD3_EXPORT ActionExecutorRef makeActionExecutor (CASDatabaseRef, ActionCacheRef, LocalExecutorRef, RemoteExecutorRef);
207
+ LLBUILD3_EXPORT LocalSandboxProviderRef makeExtLocalSandboxProvider (ExtLocalSandboxProvider);
208
+ LLBUILD3_EXPORT LocalExecutorRef makeLocalExecutor (LocalSandboxProviderRef);
209
+ LLBUILD3_EXPORT RemoteExecutorRef makeRemoteExecutor ();
179
210
180
211
struct ExtEngineConfig {
181
212
std::optional<LabelPB> initRule;
@@ -188,6 +219,8 @@ class EngineRef {
188
219
public:
189
220
EngineRef (std::shared_ptr<Engine> engine) : engine(engine) { }
190
221
222
+ LLBUILD3_EXPORT CASDatabaseRef cas ();
223
+
191
224
LLBUILD3_EXPORT BuildRef build (const LabelPB artifact);
192
225
};
193
226
0 commit comments