private static Func <JobHeader, JobExecution> New(JobExecutionRepositoryFactoryContext context) { return(job => { Guid identifier = Guid.NewGuid(); string prefix = identifier.ToHex(); string name = job.Identifier.ToHex(); int version = job.Version; string root = Path.Combine(context.Location, $"{prefix}-{name}-{version}"); string blob = Path.Combine(root, "blob"); string metadata = Path.Combine(root, "metadata"); Directory.CreateDirectory(root); Directory.CreateDirectory(blob); Directory.CreateDirectory(metadata); return JobExecutionFactory.Build(with => { with.Entry = new JobExecutionFileEntry { Job = job, Path = root, Identifier = identifier }; }); }); }
private static Func<JobHeader, JobExecution> New(JobExecutionRepositoryFactoryContext context) { return job => { Guid identifier = Guid.NewGuid(); string prefix = identifier.ToHex(); string name = job.Identifier.ToHex(); int version = job.Version; string root = Path.Combine(context.Location, $"{prefix}-{name}-{version}"); string blob = Path.Combine(root, "blob"); string metadata = Path.Combine(root, "metadata"); Directory.CreateDirectory(root); Directory.CreateDirectory(blob); Directory.CreateDirectory(metadata); return JobExecutionFactory.Build(with => { with.Entry = new JobExecutionFileEntry { Job = job, Path = root, Identifier = identifier }; }); }; }
private static Func <Guid, JobExecution> GetById(JobExecutionRepositoryFactoryContext context) { return(identifier => { foreach (JobExecutionFileEntry entry in Query(context.Location)) { if (entry.Identifier == identifier) { return JobExecutionFactory.Build(with => { with.Entry = entry; }); } } return null; }); }
private static Func<Guid, JobExecution> GetById(JobExecutionRepositoryFactoryContext context) { return identifier => { foreach (JobExecutionFileEntry entry in Query(context.Location)) { if (entry.Identifier == identifier) { return JobExecutionFactory.Build(with => { with.Entry = entry; }); } } return null; }; }
private static Func <JobHeader, JobExecution[]> GetByJob(JobExecutionRepositoryFactoryContext context) { return(job => { List <JobExecution> executions = new List <JobExecution>(); foreach (JobExecutionFileEntry entry in Query(context.Location)) { if (entry.Job == job) { executions.Add(JobExecutionFactory.Build(with => { with.Entry = entry; })); } } return executions.ToArray(); }); }
private static Func<JobHeader, JobExecution[]> GetByJob(JobExecutionRepositoryFactoryContext context) { return job => { List<JobExecution> executions = new List<JobExecution>(); foreach (JobExecutionFileEntry entry in Query(context.Location)) { if (entry.Job == job) { executions.Add(JobExecutionFactory.Build(with => { with.Entry = entry; })); } } return executions.ToArray(); }; }