1313#ifndef LLBUILD3_SWIFTADAPTORS_H
1414#define LLBUILD3_SWIFTADAPTORS_H
1515
16+ #include < cstdint>
1617#include < functional>
1718#include < memory>
1819#include < optional>
@@ -38,6 +39,7 @@ typedef std::string CacheValuePB;
3839typedef std::string CASIDBytes;
3940typedef std::string CASObjectPB;
4041typedef std::string ErrorPB;
42+ typedef std::string FileObjectPB;
4143typedef std::string LabelPB;
4244typedef std::string SignaturePB;
4345typedef std::string TaskContextPB;
@@ -57,7 +59,7 @@ typedef std::shared_ptr<CASDatabase> CASDatabaseRef;
5759struct ExtCASDatabase {
5860 void * ctx;
5961
60- // FIXME: cleanup context
62+ void (*releaseFn)( void * ctx);
6163
6264 void (*containsFn)(void * ctx, CASIDBytes id, std::function<void (bool , ErrorPB)>);
6365 void (*getFn)(void * ctx, CASIDBytes id, std::function<void (CASObjectPB, ErrorPB)>);
@@ -173,9 +175,38 @@ typedef std::shared_ptr<ActionCache> ActionCacheRef;
173175LLBUILD3_EXPORT ActionCacheRef makeExtActionCache (ExtActionCache extCache);
174176LLBUILD3_EXPORT ActionCacheRef makeInMemoryActionCache ();
175177
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+
176198class ActionExecutor ;
199+ class LocalExecutor ;
200+ class LocalSandboxProvider ;
201+ class RemoteExecutor ;
177202typedef 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 ();
179210
180211struct ExtEngineConfig {
181212 std::optional<LabelPB> initRule;
@@ -188,6 +219,8 @@ class EngineRef {
188219public:
189220 EngineRef (std::shared_ptr<Engine> engine) : engine(engine) { }
190221
222+ LLBUILD3_EXPORT CASDatabaseRef cas ();
223+
191224 LLBUILD3_EXPORT BuildRef build (const LabelPB artifact);
192225};
193226
0 commit comments