SAM_DATA_STORE(3)
πΎ SAM_DATA_STORE(3) πΎ
okay bestie, welcome to the Corosync Cluster Engine Programmer's Manual β¨ this is the page for sam_data_store(3), and we're gonna make it make sense, fr fr π«Ά
πΈ NAME πΈ
sam_data_store β store user data π
(yes that's it, that's the whole name section, she's concise)
β¨ SYNOPSIS β¨
#include <corosync/sam.h>
cs_error_t sam_data_store (const void *data, size_t size);
π DESCRIPTION π
so the sam_data_store function is the one you call when you wanna store data, and the whole point is that this data survives between instances π like it outlives the current you, iconic behavior honestly.
the data parameter is a pointer to the memory holding the data you wanna store. and here's the cute part: the data gets stored in newly allocated memory inside the library, so the caller can safely delete their own copy right after the function call returns π§ no strings attached, no lingering references, we love a clean break.
you can also pass NULL as the parameter to remove and free whatever data was saved before. and in that case? the size argument is just ignored bestie, she said "not today" π
the size parameter is the length of the data. that's it, that's the whole job.
wanna know how big your stored data is? usesam_data_getsize(3)π wanna get it back? usesam_data_restore(3)π¦
π RETURN VALUE π
this call returns CS_OK if everything slayed, otherwise an error comes back at you. no cap π
π ERRORS π
CS_ERR_BAD_HANDLEβ the component was never initialized by callingsam_initialize(3), or it already got finalized. like, you showed up to the party with no invite, or you showed up after everyone left πCS_ERR_NO_MEMORYβ internalmalloc/reallocfailed because the data is too large. she simply could not hold all that πCS_ERR_LIBRARYβ some internal error showed up, mostly because communication with the parent process failed. it's giving "it's not you, it's the parent process" π
π SEE ALSO π
and also, since we're being thorough (we always are π ), here are the general error codes that can pop up too:
CS_ERR_TRY_AGAINβ Resource temporarily unavailableCS_ERR_INVALID_PARAMβ Invalid argumentCS_ERR_ACCESSβ Permission deniedCS_ERR_LIBRARYβ The connection failedCS_ERR_INTERRUPTβ System call interrupted by a signalCS_ERR_NOT_SUPPORTEDβ The requested protocol/functionality not supportedCS_ERR_MESSAGE_ERRORβ Incorrect auth message receivedCS_ERR_NO_MEMORYβ Not enough memory to complete the requested task
and that's the whole page, bestie!! this little cutie came from the corosync Man Page, dated 04/15/2010 πΈ go forth and store your data, you absolute main character πβ¨π
π¦ where this page comes from
- debian bookworm: libsam-dev 3.1.7-1+deb12u2 Β· BSD-3-Clause
- debian trixie: libsam-dev 3.1.9-2+deb13u1 Β· BSD-3-Clause
- epel 9: corosynclib-devel 3.1.10-0.2.el9.1 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.10-3.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.10-3.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.9-5.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.9-5.fc43 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-4.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-4.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-6.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-6.fc44 Β· BSD-3-Clause
- nixos 26.05: corosync 3.1.9
- nixpkgs unstable: corosync 3.1.9
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- ubuntu jammy: libsam-dev 3.1.6-1ubuntu1 Β· BSD-3-Clause
- ubuntu jammy: libsam-dev 3.1.6-1ubuntu1.2 Β· BSD-3-Clause
- ubuntu noble: libsam-dev 3.1.7-1ubuntu3 Β· BSD-3-Clause
- ubuntu noble: libsam-dev 3.1.7-1ubuntu3.2 Β· BSD-3-Clause
- ubuntu questing: libsam-dev 3.1.9-2ubuntu1
- ubuntu questing: libsam-dev 3.1.9-2ubuntu1.1
- ubuntu resolute: libsam-dev 3.1.9-2ubuntu3 Β· BSD-3-Clause
- ubuntu stonking: libsam-dev 3.1.10-3ubuntu1 Β· BSD-3-Clause
- Copyright (c) 2010 Red Hat, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms