buildServerDependencies function
Builds the ServerDependencies graph from config: the file store (local or
S3), a file-backed job store, the pipeline render runner + queue, retention,
and the download-token signer.
This is the composition root the server entrypoint calls. Job records live on
the local disk (under the storage dir) so they survive a restart even with an
S3 file backend; schemaJson is the VideoSpec schema to serve.
Implementation
ServerDependencies buildServerDependencies(ServerConfig config, {String schemaJson = '{}'}) {
final fileStore = config.storageBackend == StorageBackend.s3
? _s3FileStore(config.s3!)
: LocalFileStore(Directory(config.localStorageDir));
final jobStore = FileJobStore(Directory('${config.localStorageDir}/.jobs'));
final queue = RenderQueue(
runner: PipelineRenderRunner(
renderProject: config.renderProject,
ffmpegPath: config.ffmpegPath,
aiEnv: config.aiEnv,
),
jobStore: jobStore,
fileStore: fileStore,
fileTtl: config.fileTtl,
concurrency: config.renderConcurrency,
);
return ServerDependencies(
config: config,
queue: queue,
jobStore: jobStore,
fileStore: fileStore,
retention: DefaultRetentionService(jobStore, fileStore),
signer: DownloadTokenSigner(config.downloadSigningKey),
schemaJson: schemaJson,
);
}