Skip to content

Instantly share code, notes, and snippets.

@fsaintjacques
Created April 1, 2017 01:37
Show Gist options
  • Save fsaintjacques/6cc2a6924df83f0e6bbd6fa9abe79b3f to your computer and use it in GitHub Desktop.
Save fsaintjacques/6cc2a6924df83f0e6bbd6fa9abe79b3f to your computer and use it in GitHub Desktop.
#include <stdbool.h>
#include <stdint.h>
/* The state of a healthcheck. */
enum sk_health_state {
/* The check is in an unknown state, probably due to an internal error. */
SK_HEALTH_STATE_UNKNOWN = 0,
/* The check is healthy. */
SK_HEALTH_STATE_OK = 1,
/* The check is healthy but will soon reach unhealthy level; preventive
* action should be taken. */
SK_HEALTH_STATE_WARN = 2,
/* The check is unhealthy; action needs to be taken immediately. */
SK_HEALTH_STATE_CRITICAL = 3,
};
/* Healthcheck interface.
*/
typedef enum sk_health_state (*sk_healthcheck_cb_t)(
const void* opaque, sk_buf_t* err_msg);
enum {
SK_HEALTHCHECK_ENABLED = 1,
};
typedef struct sk_healtcheck {
/* The name of the healthcheck. */
const char* name;
/* A brief description of the healthcheck. */
const char* description;
uint64_t flags;
/* User provided callback that implements the healthcheck. */
sk_healthcheck_cb_t callback;
/* User provided data given to the callback. */
void* opaque;
} sk_healthcheck_t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment