diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-06-29 07:21:15 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-06-29 14:00:36 +0530 |
commit | bf2d66357b9135442f9dec277678b0597abc1d15 (patch) | |
tree | 0992fb6017d19c1c2c1b6eae660896fd042f6a0f /include | |
parent | b3fe04359cd0c3a1b9a1bed55d804c2897ad4eac (diff) |
solver_util: init
Diffstat (limited to 'include')
-rw-r--r-- | include/jobs.h | 11 | ||||
-rw-r--r-- | include/queue.h | 2 | ||||
-rw-r--r-- | include/solver_util.h | 11 |
3 files changed, 20 insertions, 4 deletions
diff --git a/include/jobs.h b/include/jobs.h index 7390306..54152cf 100644 --- a/include/jobs.h +++ b/include/jobs.h @@ -9,20 +9,23 @@ struct output { }; struct job { - char *name, *drv_path, *attr; + char *name, *drv_path, *nix_attr_name; bool scheduled; bool insubstituters; - size_t outputs_size, outputs_filled; struct output **outputs; + /* DAG */ size_t deps_size, deps_filled; struct job **deps; - size_t parents_size, parents_filled; struct job **parents; + /* queue */ CIRCLEQ_ENTRY(job) clist; + + /* solver */ + ssize_t id; }; CIRCLEQ_HEAD(job_clist, job); @@ -37,7 +40,7 @@ typedef enum { int job_read(FILE *stream, struct job **jobs); /* Spawns nix-eval-jobs and connects its stdout to stream */ -int jobs_init(FILE **stream, const char *expr); +int jobs_init(FILE **stream, char *expr); void job_free(struct job *j); int job_parents_list_insert(struct job *job, struct job *parent); void job_deps_list_rm(struct job *job, struct job *dep); diff --git a/include/queue.h b/include/queue.h index 4aca54b..fee5bb3 100644 --- a/include/queue.h +++ b/include/queue.h @@ -5,6 +5,7 @@ #include "htab.h" #include "jobs.h" +#include "solver_util.h" #ifndef QUEUE_H @@ -16,6 +17,7 @@ typedef enum { struct queue { struct job_clist jobs; struct htab *htab; + struct job_ids *job_ids; sem_t sem; queue_state_t state; pthread_mutex_t mutex; diff --git a/include/solver_util.h b/include/solver_util.h new file mode 100644 index 0000000..99d5fcd --- /dev/null +++ b/include/solver_util.h @@ -0,0 +1,11 @@ +#include "jobs.h" + +#ifndef SOLVER_UTIL_H + +struct job_ids { + struct job **jobs; + ssize_t filled, size; +}; + +#define SOLVER_UTIL_H +#endif |