summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJim Cheung <jim.cheung@phazr.io>2017-01-23 13:55:24 -0800
committerjimcheung <jim.cheung@phazr.io>2017-02-28 11:14:11 -0800
commit06e50ea86b6de729fa5dbc23ef41af87b19e636a (patch)
treeace75bea1a47a5a380af8913923956fdcd693679 /include
parent0794b31c623e4cede76d66be730719d24debcca9 (diff)
downloadliberasurecode-06e50ea86b6de729fa5dbc23ef41af87b19e636a.tar.gz
Add Phazr.IO libphazr backend to liberasurecode
Currently, there are several implementations of erasure codes that are available within OpenStack Swift. Most, if not all, of which are based on the Reed Solomon coding algorithm. Phazr.IO’s Erasure Coding technology uses a patented algorithm which are significantly more efficient and improves the speed of coding, decoding and reconstruction. In addition, Phazr.IO Erasure Code use a non-systematic algorithm which provides data protection at rest and in transport without the need to use encryption. Please contact support@phazr.io for more info on our technology. Change-Id: I4e40d02a8951e38409ad3c604c5dd6f050fa7ea0
Diffstat (limited to 'include')
-rw-r--r--include/erasurecode/erasurecode.h1
-rw-r--r--include/erasurecode/erasurecode_backend.h29
2 files changed, 23 insertions, 7 deletions
diff --git a/include/erasurecode/erasurecode.h b/include/erasurecode/erasurecode.h
index f5f0fde..0a5f98e 100644
--- a/include/erasurecode/erasurecode.h
+++ b/include/erasurecode/erasurecode.h
@@ -49,6 +49,7 @@ typedef enum {
EC_BACKEND_SHSS = 5,
EC_BACKEND_LIBERASURECODE_RS_VAND = 6,
EC_BACKEND_ISA_L_RS_CAUCHY = 7,
+ EC_BACKEND_LIBPHAZR = 8,
EC_BACKENDS_MAX,
} ec_backend_id_t;
diff --git a/include/erasurecode/erasurecode_backend.h b/include/erasurecode/erasurecode_backend.h
index 4199344..2cf7094 100644
--- a/include/erasurecode/erasurecode_backend.h
+++ b/include/erasurecode/erasurecode_backend.h
@@ -1,4 +1,4 @@
-/*
+/*
* <Copyright>
*
* Redistribution and use in source and binary forms, with or without
@@ -64,6 +64,8 @@ struct ec_backend_args {
#define RECONSTRUCT reconstruct
#define ELEMENTSIZE element_size
#define ISCOMPATIBLEWITH is_compatible_with
+#define GETMETADATASIZE get_backend_metadata_size
+#define GETENCODEOFFSET get_encode_offset
#define FN_NAME(s) str(s)
#define str(s) #s
@@ -90,7 +92,10 @@ struct ec_backend_op_stubs {
int blocksize);
int (*ELEMENTSIZE)(void *desc);
- bool (*ISCOMPATIBLEWITH) (uint32_t version);
+ bool (*ISCOMPATIBLEWITH)(uint32_t version);
+
+ size_t (*GETMETADATASIZE)(void *desc, int blocksize);
+ size_t (*GETENCODEOFFSET)(void *desc, int metadata_size);
};
/* ==~=*=~==~=*=~==~=*=~= backend struct definitions =~=*=~==~=*=~==~=*==~== */
@@ -109,11 +114,6 @@ struct ec_backend_common {
char soversion[MAX_LEN]; /* EC backend shared library version */
struct ec_backend_op_stubs *ops; /* EC backend stubs */
- size_t backend_metadata_size;
- /* EC backend custom metadata size -
- * backend_metadata_size bytes are added to
- * the fragment size when allocating
- * data/parity fragment buffers */
uint32_t ec_backend_version; /* The revision number of this back
* end. Is used to determine whether
* a specific instance of this backend
@@ -162,6 +162,21 @@ ec_backend_t liberasurecode_backend_lookup_by_name(const char *name);
*/
ec_backend_t liberasurecode_backend_instance_get_by_desc(int desc);
+/* Common function for backends */
+/**
+ * A function to return 0 for generic usage on backends for get_encode_offset
+ *
+ * Returns 0 always
+ */
+static inline size_t get_encode_offset_zero(void *desc, int metadata_size){ return 0; }
+
+/**
+ * A function to return 0 for generic usage on backends for get_backend_metadata_size
+ *
+ * Returns 0 always
+ */
+static inline size_t get_backend_metadata_size_zero(void *desc, int blocksize){ return 0; }
+
/* =~=*=~==~=*=~==~=*=~==~=*=~===~=*=~==~=*=~===~=*=~==~=*=~===~=*=~==~=*=~= */
#ifdef __cplusplus