librsync  2.3.2
Functions
job.c File Reference

Generic state-machine interface. More...

Go to the source code of this file.

Functions

static rs_result rs_job_work (rs_job_t *job, rs_buffers_t *buffers)
 
rs_job_trs_job_new (char const *job_name, rs_result(*statefn)(rs_job_t *))
 
rs_result rs_job_free (rs_job_t *job)
 Deallocate job state. More...
 
static rs_result rs_job_complete (rs_job_t *job, rs_result result)
 
rs_result rs_job_iter (rs_job_t *job, rs_buffers_t *buffers)
 Run a rs_job state machine until it blocks (RS_BLOCKED), returns an error, or completes (RS_DONE). More...
 
const rs_stats_trs_job_statistics (rs_job_t *job)
 Return a pointer to the statistics in a job. More...
 
int rs_job_input_is_ending (rs_job_t *job)
 
rs_result rs_job_drive (rs_job_t *job, rs_buffers_t *buf, rs_driven_cb in_cb, void *in_opaque, rs_driven_cb out_cb, void *out_opaque)
 Actively process a job, by making callbacks to fill and empty the buffers until the job is done. More...
 

Detailed Description

Generic state-machine interface.

The point of this is that we need to be able to suspend and resume processing at any point at which the buffers may block.

See also
Streaming API
rs_job_iter()
rs_job

Definition in file job.c.

Function Documentation

◆ rs_job_free()

rs_result rs_job_free ( rs_job_t job)

Deallocate job state.

Definition at line 66 of file job.c.

◆ rs_job_iter()

rs_result rs_job_iter ( rs_job_t job,
rs_buffers_t buffers 
)

Run a rs_job state machine until it blocks (RS_BLOCKED), returns an error, or completes (RS_DONE).

Parameters
jobDescription of job state.
buffersPointer to structure describing input and output buffers.
Returns
The rs_result that caused iteration to stop.

buffers->eof_in should be true if there is no more data after what's in the input buffer. The final block checksum will run across whatever's in there, without trying to accumulate anything else.

See also
Streaming API

Definition at line 93 of file job.c.

◆ rs_job_statistics()

const rs_stats_t* rs_job_statistics ( rs_job_t job)

Return a pointer to the statistics in a job.

Definition at line 142 of file job.c.

◆ rs_job_drive()

rs_result rs_job_drive ( rs_job_t job,
rs_buffers_t buf,
rs_driven_cb  in_cb,
void *  in_opaque,
rs_driven_cb  out_cb,
void *  out_opaque 
)

Actively process a job, by making callbacks to fill and empty the buffers until the job is done.

Definition at line 152 of file job.c.