CMAP_DISPATCH(3)

πŸ’– CMAP_DISPATCH πŸ’–

okay bestie, gather round, because this is the Corosync Cluster Engine Programmer's Manual entry for cmap_dispatch, and honestly? it's giving "the function that makes your callbacks actually happen." ✨


🌸 NAME 🌸

cmap_dispatch β€” dispatches callbacks from the CMAP service πŸ¦‹

Basically it's the little engine that goes and collects your callbacks and hands them to you. The CMAP service is out here holding your configuration changes, and this is the girl who knocks on the door and says "ma'am, your callbacks are ready." πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <corosync/cmap.h>

cs_error_t cmap_dispatch (cmap_handle_t handle, cs_dispatch_flags_t
dispatch_types);

so you include <corosync/cmap.h> first β€” non-negotiable, no cap β€” and then you call cmap_dispatch with your handle and your dispatch_types. That's it, that's the whole thing. 🌈


✨ DESCRIPTION ✨

So the cmap_dispatch function is used to dispatch configuration changes. That's literally its whole job and it does it beautifully. πŸ‘‘

Each application may have several connections to the CMAP API. Each application uses the handle argument to uniquely identify the connection. So like... one girl can have multiple group chats, and the handle is how you tell them apart. Don't mix them up, bestie. πŸ™ˆ

The dispatch_types argument is used to identify the type of dispatch to execute. The possible types are CS_DISPATCH_ONE, CS_DISPATCH_ALL and CS_DISPATCH_BLOCKING. Pick one. Choose your fighter. ⭐

The dispatch values have the following meanings:

πŸ’« the dispatch values, explained with love πŸ’«

  • CS_DISPATCH_ONE β€” Dispatch at least one callback, blocking until the callback is dispatched. So it'll wait, patiently, like a good friend outside the fitting room. πŸŽ€
  • CS_DISPATCH_ALL β€” Dispatch all waiting callbacks without blocking to wait for any callbacks. She's efficient, she's not waiting around, she's got places to be. ✨
  • CS_DISPATCH_BLOCKING β€” Dispatch all callbacks blocking indefinitely. This is used in a threaded program where a thread is created, and then cs_dispatch() is called immediately from the created thread to execute callbacks. Indefinitely, bestie. Forever. Until further notice. πŸ’€
  • CS_DISPATCH_ONE_NONBLOCKING β€” Dispatch at most one callback. If there is no pending callback, CS_ERR_TRY_AGAIN is returned. She checks, she's like "nope, nothing here," and she leaves. No loitering. πŸ¦‹

It's needed to call cmap_track_add(3) to add tracked items and receive callbacks. Like, you literally cannot get callbacks without tracking something first. That's the prerequisite, that's the price of admission, that's the vibe check. πŸ’œ


πŸ”₯ RETURN VALUE πŸ”₯

This call returns the CS_OK value if successful, otherwise an error is returned. That's the whole deal. If you got CS_OK, we're slaying. If not... scroll down, bestie, there's a whole list. 😭


🌟 SEE ALSO 🌟


πŸ’… the error codes (know them, fear them, respect them) πŸ’…

  • CS_ERR_TRY_AGAIN β€” Resource temporarily unavailable
  • CS_ERR_INVALID_PARAM β€” Invalid argument
  • CS_ERR_ACCESS β€” Permission denied
  • CS_ERR_LIBRARY β€” The connection failed
  • CS_ERR_INTERRUPT β€” System call interrupted by a signal
  • CS_ERR_NOT_SUPPORTED β€” The requested protocol/functionality not supported
  • CS_ERR_MESSAGE_ERROR β€” Incorrect auth message received
  • CS_ERR_NO_MEMORY β€” Not enough memory to complete the requested task
fr fr, if you see CS_ERR_TRY_AGAIN after a CS_DISPATCH_ONE_NONBLOCKING call, that's not a bug, that's just the function telling you there was nothing waiting. She's not ghosting you, there was genuinely no callback. 🫢

and that's the whole page, bestie β€” go forth and dispatch your callbacks, you absolute icon, you main character, you configuration-change-receiving queen πŸ‘‘

this has been the corosync Man Page, dated 23/01/2012, from the Corosync Cluster Engine Programmer's Manual β€” mwah, take care of her πŸ’–

πŸ“¦ where this page comes from