chiark / gitweb /
import: rename download code from "import" to "pull"
[elogind.git] / src / import / pull-job.h
similarity index 54%
rename from src/import/import-job.h
rename to src/import/pull-job.h
index 2c01d723dbb71487ed8304fdd3764d1617370dcc..b807bd1b410af8acb43e84c002e2a26b2db881a0 100644 (file)
 #include "macro.h"
 #include "curl-util.h"
 
-typedef struct ImportJob ImportJob;
-
-typedef void (*ImportJobFinished)(ImportJob *job);
-typedef int (*ImportJobOpenDisk)(ImportJob *job);
-typedef int (*ImportJobHeader)(ImportJob *job, const char *header, size_t sz);
-typedef void (*ImportJobProgress)(ImportJob *job);
-
-typedef enum ImportJobState {
-        IMPORT_JOB_INIT,
-        IMPORT_JOB_ANALYZING, /* Still reading into ->payload, to figure out what we have */
-        IMPORT_JOB_RUNNING,  /* Writing to destination */
-        IMPORT_JOB_DONE,
-        IMPORT_JOB_FAILED,
-        _IMPORT_JOB_STATE_MAX,
-        _IMPORT_JOB_STATE_INVALID = -1,
-} ImportJobState;
-
-#define IMPORT_JOB_STATE_IS_COMPLETE(j) (IN_SET((j)->state, IMPORT_JOB_DONE, IMPORT_JOB_FAILED))
-
-typedef enum ImportJobCompression {
-        IMPORT_JOB_UNCOMPRESSED,
-        IMPORT_JOB_XZ,
-        IMPORT_JOB_GZIP,
-        IMPORT_JOB_BZIP2,
-        _IMPORT_JOB_COMPRESSION_MAX,
-        _IMPORT_JOB_COMPRESSION_INVALID = -1,
-} ImportJobCompression;
-
-struct ImportJob {
-        ImportJobState state;
+typedef struct PullJob PullJob;
+
+typedef void (*PullJobFinished)(PullJob *job);
+typedef int (*PullJobOpenDisk)(PullJob *job);
+typedef int (*PullJobHeader)(PullJob *job, const char *header, size_t sz);
+typedef void (*PullJobProgress)(PullJob *job);
+
+typedef enum PullJobState {
+        PULL_JOB_INIT,
+        PULL_JOB_ANALYZING, /* Still reading into ->payload, to figure out what we have */
+        PULL_JOB_RUNNING,  /* Writing to destination */
+        PULL_JOB_DONE,
+        PULL_JOB_FAILED,
+        _PULL_JOB_STATE_MAX,
+        _PULL_JOB_STATE_INVALID = -1,
+} PullJobState;
+
+#define PULL_JOB_STATE_IS_COMPLETE(j) (IN_SET((j)->state, PULL_JOB_DONE, PULL_JOB_FAILED))
+
+typedef enum PullJobCompression {
+        PULL_JOB_UNCOMPRESSED,
+        PULL_JOB_XZ,
+        PULL_JOB_GZIP,
+        PULL_JOB_BZIP2,
+        _PULL_JOB_COMPRESSION_MAX,
+        _PULL_JOB_COMPRESSION_INVALID = -1,
+} PullJobCompression;
+
+struct PullJob {
+        PullJobState state;
         int error;
 
         char *url;
 
         void *userdata;
-        ImportJobFinished on_finished;
-        ImportJobOpenDisk on_open_disk;
-        ImportJobHeader on_header;
-        ImportJobProgress on_progress;
+        PullJobFinished on_finished;
+        PullJobOpenDisk on_open_disk;
+        PullJobHeader on_header;
+        PullJobProgress on_progress;
 
         CurlGlue *glue;
         CURL *curl;
@@ -92,7 +92,7 @@ struct ImportJob {
 
         usec_t mtime;
 
-        ImportJobCompression compressed;
+        PullJobCompression compressed;
         lzma_stream xz;
         z_stream gzip;
         bz_stream bzip2;
@@ -112,11 +112,11 @@ struct ImportJob {
         uint64_t written_since_last_grow;
 };
 
-int import_job_new(ImportJob **job, const char *url, CurlGlue *glue, void *userdata);
-ImportJob* import_job_unref(ImportJob *job);
+int pull_job_new(PullJob **job, const char *url, CurlGlue *glue, void *userdata);
+PullJob* pull_job_unref(PullJob *job);
 
-int import_job_begin(ImportJob *j);
+int pull_job_begin(PullJob *j);
 
-void import_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result);
+void pull_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result);
 
-DEFINE_TRIVIAL_CLEANUP_FUNC(ImportJob*, import_job_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(PullJob*, pull_job_unref);