Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ManagedObjectBackends for HSM #149

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions include/core/jconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <glib.h>

#include <core/jbackend.h>
#include <core/jlist.h>

G_BEGIN_DECLS

Expand All @@ -43,6 +44,14 @@ struct JConfiguration;

typedef struct JConfiguration JConfiguration;

struct JStorageTier
{
guint64 bandwidth; ///< bandwidth in byte ber second
guint64 latency; ///< latency in ns
guint64 capacity; ///< capacity in byte
};
typedef struct JStorageTier JStorageTier;

/**
* Returns the configuration.
*
Expand Down Expand Up @@ -116,6 +125,10 @@ guint64 j_configuration_get_stripe_size(JConfiguration*);

gchar const* j_configuration_get_checksum(JConfiguration*);

gchar const* j_configuration_get_object_policy_kv_backend(JConfiguration*);
gchar const* j_configuration_get_object_policy_kv_path(JConfiguration*);
gchar const* j_configuration_get_object_policy(JConfiguration*);
gchar const* const* j_configuration_get_object_policy_args(JConfiguration*);
G_END_DECLS

/**
Expand Down
63 changes: 63 additions & 0 deletions include/core/jhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,69 @@

G_BEGIN_DECLS

/**
* Execudes a command which returns true on success.
* on error a warning is written and jumps to <err_label> in the form:
* EXE failed at <File>:<Line>: with
* "<format string>", args
*
* \param cmd command to execute
* \param err_label label to jump to, when failed
* \param ... warning message in form: <format string>, args
**/
#define EXE(cmd, err_label, ...) \
do \
{ \
if ((cmd) == FALSE) \
{ \
g_warning("EXE failed at %s:%d with:", __FILE__, __LINE__); \
g_warning(__VA_ARGS__); \
goto err_label; \
} \
} while (FALSE)

/**
* Checks if <res> is an non negative number, if it negative jumps to <err_label>
* and print a warning in the form:
* CHECK failed at <File>:<Line> with (<res>):
* "<format string>", args
*
* \param res result value
* \param err_label label to jump to at error
* \param ... warning message in form: <format string>, args
**/
#define CHECK(res, err_label, ...) \
do \
{ \
if (res < 0) \
{ \
g_warning("CHECK failed at %s:%d with (%d):", __FILE__, __LINE__, res); \
g_warning(__VA_ARGS__); \
goto err_label; \
} \
} while (FALSE)

/**
* Check if <error> is an filled GError, if print warning and jumps to <err_label>
* warnings has the form:
* CHECK failed at <File>:<Line> with:
* "<format string>", args
*
* \param error GError
* \param err_label label to jump to at error
* \param ... warning message in form: <format sting>, args
**/
#define CHECK_GERROR(error, err_label, ...) \
do \
{ \
if (error != NULL) \
{ \
g_warning("CHECK failed at %s:%d with:\n\t%s", __FILE__, __LINE__, error->message); \
g_error_free(error); \
goto err_label; \
} \
} while (FALSE)

/**
* \defgroup JHelper Helper
*
Expand Down
Loading