gd_flush(3)
πΎ gd_flush(3) β GETDATA πΎ
okay bestie so we're doing the GETDATA flush-and-close trio today and honestly?? these three little functions are the ones that make sure your Dirfile actually writes itself down instead of just vibing in RAM like a menace. π«Ά
β¨ NAME β¨
gd_flush, gd_raw_close, gd_sync β write all pending Dirfile changes to disk, or close open raw fields. basically: save it or shut it. π
πΈ SYNOPSIS πΈ
#include <getdata.h>
int gd_flush(DIRFILE *dirfile, const char *field_code);
int gd_raw_close(DIRFILE *dirfile, const char *field_code);
int gd_sync(DIRFILE *dirfile, const char *field_code);
π¦ DESCRIPTION π¦
so. gd_sync() is the one that pushes all the pending writes to disk for the raw data files associated with field_code, or with its input(s), in the dirfile that you handed over as dirfile. and if field_code has a valid representation suffix on it?? it gets ignored. like, not today, suffix. π
β¨ special case alert β¨ if you passNULLasfield_codetogd_sync(), then every single field indirfilegets flushed. and in that same special case, modified metadata also gets flushed to disk, exactly as ifgd_metaflush(3)had been called. iconique behavior, no notes. π
also lowkey important: if the dirfile was opened read-only, this function does literally nothing. and on top of that, some encoding schemes may just implement this whole thing as a NOP. so likeβ¦ sometimes it's giving nothing on purpose. π
gd_raw_close() closes any raw data files that GetData has opened which are associated with field_code, or with its input(s). and again β if field_code is NULL, then all open data files get closed. πβοΈ and heads up: the I/O pointer of any RAW field that gets closed is reset to the beginning-of-field. so it's not just closing, it's also rewinding, bestie. βͺ
calling gd_flush() is essentially equivalent to calling gd_sync() first and then gd_raw_close() (ie. it does both of those tasks), though if field_code is NULL, the order of operations may be different than making those two explicit calls. so same destination, possibly different route. πΊοΈβ¨
π RETURN VALUE π
on success, all three of these return zero. slay. on error, a negative-valued error code comes back. possible error codes are:
GD_E_ALLOCβ the library could not allocate memory. it simply did not have the bandwidth. πGD_E_BAD_CODEβ the field specified byfield_codewas not found in the database. it's not there, girl. πGD_E_BAD_DIRFILEβ the supplied dirfile was invalid. π©GD_E_IOβ an I/O error happened while trying to write modified data or metadata to disk. πGD_E_LINE_TOO_LONGβ while attempting to flush modified metadata to disk, a field specification line exceeded the maximum allowed length. on most platforms, that maximum length is at least2**31bytes, so if you're seeing this, it typically means something pathological is happening. like genuinely what are you doing. πGD_E_RECURSE_LEVELβ too many levels of recursion were hit while trying to resolvefield_code. this usually means there's a circular dependency in the field specification in the dirfile. ππ¨
the error code is also stored in the DIRFILE object, and you can go grab it after this function returns by calling gd_error(3). and if you want a descriptive error string for it, call gd_error_string(3). π«Ά
π HISTORY π
- the
dirfile_flush()function appeared inGetData-0.3.0. - in
GetData-0.7.0, this function was renamed togd_flush(). - the
gd_raw_close()andgd_sync()functions appeared inGetData-0.8.0. - in
GetData-0.10.0, the error return from these functions changed from-1to a negative-valued error code.
π SEE ALSO π
gd_close(3), gd_dirfile_standards(3), gd_error(3), gd_error_string(3), gd_metaflush(3), gd_open(3)
and that's the whole page, bestie!! this one is Version 0.10.0, dated 25 December 2016, and it's the gd_flush(3) girlies' moment to shine. go flush something. periodt. πβ¨ππ¦
π¦ where this page comes from
- debian bookworm: libgetdata-doc 0.11.0-6
- debian trixie: libgetdata-doc 0.11.0-15
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 43: getdata-devel 0.11.0-13.fc43 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- fedora 44: getdata-devel 0.11.0-14.fc44 Β· GPL-2.0-or-later
- nixos 26.05: getdata 0.11.0
- nixpkgs unstable: getdata 0.11.0
- ubuntu jammy: libgetdata-doc 0.11.0-3ubuntu1
- ubuntu noble: libgetdata-doc 0.11.0-13
- ubuntu questing: libgetdata-doc 0.11.0-15
- ubuntu resolute: libgetdata-doc 0.11.0-17build1
- ubuntu stonking: libgetdata-doc 0.11.0-17build2
- Copyright (C) 2016 D. V. Wiebe
- Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014, 2016 D. V. Wiebe
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms