GEARMAN_JOB_WORKLOAD_SIZE(3)

🌸 GEARMAN_JOB_WORKLOAD_SIZE 🌸

okay bestie, buckle up, because this is the entire libgearman job-object era in one page. it's from the Gearmand docs over at <http://gearman.info/> and it's lowkey iconic. πŸ’…


πŸ’– NAME πŸ’–

gearman_job_workload_size β€” Gearmand Documentation, <http://gearman.info/>

so like, yes, the page is named after the workload-size function, but it's actually the whole gearman_job_st situation. it's giving "one girl, forty functions". ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libgearman/gearman.h>

type gearman_job_st

void gearman_job_free(gearman_job_st *job)

gearman_return_t <#c.gearman_return_t>
gearman_job_send_data(gearman_job_st *job, const void *data, size_t <#c.size_t> data_size)

gearman_return_t <#c.gearman_return_t>
gearman_job_send_warning(gearman_job_st *job, const void *warning,
size_t <#c.size_t> warning_size)

gearman_return_t <#c.gearman_return_t>
gearman_job_send_status(gearman_job_st *job, uint32_t <#c.uint32_t>
numerator, uint32_t <#c.uint32_t> denominator)

gearman_return_t <#c.gearman_return_t>
gearman_job_send_complete(gearman_job_st *job, const void *result,
size_t <#c.size_t> result_size)

gearman_return_t <#c.gearman_return_t>
gearman_job_send_exception(gearman_job_st *job, const void *exception,
size_t <#c.size_t> exception_size)

gearman_return_t <#c.gearman_return_t>
gearman_job_send_fail(gearman_job_st *job)

const char *gearman_job_handle(const gearman_job_st *job)

const char *gearman_job_function_name(const gearman_job_st *job)

const char *gearman_job_unique(const gearman_job_st *job)

const void *gearman_job_workload(const gearman_job_st *job)

size_t <#c.size_t> gearman_job_workload_size(const gearman_job_st *job)

void *gearman_job_take_workload(gearman_job_st *job, size_t <#c.size_t>
*data_size)

gearman_client_st <#c.gearman_client_st>
*gearman_job_use_client(gearman_job_st *job)

and then, the moment you've all been waiting for:

Link with -lgearman

periodt. link it or it doesn't exist. πŸ”₯


✨ DESCRIPTION ✨

gearman_job_st is the lil struct that gets handed to your worker functions to represent the jobs that are actively being run by gearman_worker_work() <#c.gearman_worker_work>. it's basically the job's main character card. πŸ‘‘

πŸŽ€ freeing the girl

  • gearman_job_free() β€” frees a job. and listen, bestie: you only need to do this if a task was created with a preallocated structure. that's the whole rule. don't go freeing things that weren't preallocated, okay? πŸ™ˆ

πŸŽ€ the lil getters

  • gearman_job_handle() β€” returns the job handle. (peep gearman_job_handle_t <#c.gearman_job_handle_t> if you want the full tea on that.)
  • gearman_job_function_name() β€” returns the name of the function that the job was set to execute against.
  • gearman_job_unique() β€” returns the unique value that was used for gearman_job_st.

πŸŽ€ the workload section (the actual assignment)

  • gearman_job_take_workload β€” returns the gearman_job_st workload. the size of it can be determined with gearman_job_workload_size(). and here's the plot twist: gearman_job_take_workload() is exactly the same as gearman_job_workload() except that the result must be free(3)'d by the caller. so you did take it. it's yours now. you own it. clean it up. πŸ’€

πŸŽ€ the client glow-up

  • gearman_job_use_client β€” returns a gearman_client_st <#c.gearman_client_st> configured from a gearman_job_st. you can use that gearman_client_st to fire client API commands at the server. and now the important part, ok?
You do not, and should not, call gearman_client_free() <#c.gearman_client_free> on that gearman_client_st. it gets cleaned up when the job is cleaned up. so hands off. πŸ™…β€β™€οΈ

πŸ’œ RETURN VALUE πŸ’œ

a value of gearman_return_t <#c.gearman_return_t> comes back at you. on success, that value will be :c:type::GEARMAN_SUCCESS. 🫢

and if you're sitting there like "what does this number mean" β€” use gearman_strerror() <#c.gearman_strerror> to translate it into a printable string. slay, now you can read it.


🌈 HOME 🌈

wanna know more? go look: <http://gearman.info/>

it's the mothership. go touch grass there. 🌱


⭐ SEE ALSO ⭐


πŸ‘‘ Author πŸ‘‘

Data Differential <http://www.datadifferential.com/>

2011-2014, Data Differential, <http://www.datadifferential.com/>


and that's the whole page, bestie!! πŸ’– you just read the GEARMAN_JOB_WORKLOAD_SIZE(3) manual from Gearmand, version 1.1.21+ds, dated Feb 04, 2026. take that knowledge and go make your workers do incredible things. so proud of you. no cap. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from