55 job->dogtag = RS_JOB_TAG;
59 job->
stats.start = time(NULL);
61 rs_trace(
"start %s job", job_name);
71 rs_bzero(job,
sizeof *job);
81 assert(rs_tube_is_idle(job) || result !=
RS_DONE);
84 job->
stats.end = time(NULL);
88 rs_trace(
"%s job complete", job->
job_name);
96 size_t orig_in, orig_out;
103 result = rs_job_work(job, buffers);
106 && orig_in && orig_out) {
107 rs_error(
"internal error: job made no progress " "[orig_in="
108 FMT_SIZE
", orig_out=" FMT_SIZE
", final_in=" FMT_SIZE
109 ", final_out=" FMT_SIZE
"]", orig_in, orig_out,
123 job->stream = buffers;
138 return rs_job_complete(job, result);
147 int rs_job_input_is_ending(
rs_job_t *job)
149 return job->stream->
eof_in;
157 rs_bzero(buf,
sizeof *buf);
160 if (!buf->
eof_in && in_cb) {
161 iores = in_cb(job, buf, in_opaque);
171 iores = (out_cb) (job, buf, out_opaque);
Description of input and output buffers.
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)...
rs_result final_result
Final result of processing job.
rs_signature_t * signature
Pointer to the signature that's being used by the operation.
int job_owns_sig
Flag indicating signature should be destroyed with the job.
size_t avail_out
Remaining free space at next_out.
LIBRSYNC_EXPORT char const * rs_strerror(rs_result r)
Return an English description of a rs_result value.
Manage librsync streams of IO.
size_t avail_in
Number of bytes available at next_in.
rs_stats_t stats
Encoding statistics.
Public header for librsync.
const char * job_name
Human-readable job operation name.
LIBRSYNC_EXPORT void rs_free_sumset(rs_signature_t *)
Deep deallocation of checksums.
char const * op
Human-readable name of current operation.
Performance statistics from a librsync encoding or decoding operation.
rs_result
Return codes from nonblocking rsync operations.
Blocked waiting for more data.
const rs_stats_t * rs_job_statistics(rs_job_t *job)
Return a pointer to the statistics in a job.
rs_byte_t * scoop_buf
Buffer of data in the scoop.
rs_result rs_tube_catchup(rs_job_t *job)
Put whatever will fit from the tube into the output of the stream.
rs_result rs_job_free(rs_job_t *job)
Deallocate job state.
The job is still running, and not yet finished or blocked.
rs_result(* statefn)(rs_job_t *)
Callback for each processing step.
int eof_in
True if there is no more data after this.
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...
rs_result rs_driven_cb(rs_job_t *job, rs_buffers_t *buf, void *opaque)
Type of application-supplied function for rs_job_drive().
The contents of this structure are private.