summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2018-03-09 20:07:19 +0530
committerAmar Tumballi <amarts@redhat.com>2018-04-10 01:09:29 +0000
commit48623a33a0ef38f6c99208b0580954d7d7c80e76 (patch)
treebbe9aa572b36a41c3c64b93c43f2d43fd2634bd1 /libglusterfs
parentf946d98a95249c8d906323e6419ec8538467d2ab (diff)
experimental/cloudsync: Download xlator for archival feature
spec-files: https://review.gluster.org/#/c/18854/ Overview: * Cloudsync maintains three file states in it's inode-ctx i.e 1 - LOCAL, 2 - REMOTE, 3 - DOWNLOADING. * A data modifying fop is allowed only if the state is LOCAL. If the state is REMOTE or DOWNLOADING, client will download or wait for the download to finish initiated by other client. * Multiple download and upload from different clients are synchronized by inodelk. * In POSIX a state check is done (part of different commit)before allowing the fop to continue. If the state is remote/downloading the fop is unwound with EREMOTE. The client will then download the file and continue with the fop again. * Basic Algo for fop (let's say write fop): - If LOCAL -> resume fop - If REMOTE -> - INODELK - STAT (this gets state and heal the state if needed) - DOWNLOAD - resume fop Note: * Developers will need to write plugins for download, based on the remote store they choose. In phase-1, support will be added for one remote store per volume. In future, more options for multiple remote stores will be explored. TODOs: - Implement stat/lookup/readdirp to return size info from xattr - Make plugins configurable - Implement unlink fop - Add metrics collection - Add sharding support Design Contributions: Aravinda V K <avishwan@redhat.com> Amar Tumballi <amarts@redhat.com> Ram Ankireddypalle <areddy@commvault.com> Susant Palai <spalai@redhat.com> updates: #387 Change-Id: Iddf711ee7ab4e946ae3e472ff62791a7b85e6d4b Signed-off-by: Susant Palai <spalai@redhat.com>
Diffstat (limited to 'libglusterfs')
-rwxr-xr-xlibglusterfs/src/generator.py10
-rw-r--r--libglusterfs/src/glusterfs.h16
2 files changed, 24 insertions, 2 deletions
diff --git a/libglusterfs/src/generator.py b/libglusterfs/src/generator.py
index c9311ea3856..3072382c7a5 100755
--- a/libglusterfs/src/generator.py
+++ b/libglusterfs/src/generator.py
@@ -714,7 +714,7 @@ def get_error_arg (type_str):
return "NULL"
return "-1"
-def get_subs (names, types):
+def get_subs (names, types, cbktypes=None):
sdict = {}
sdict["@SHORT_ARGS@"] = string.join(names,", ")
# Convert two separate tuples to one of (name, type) sub-tuples.
@@ -725,6 +725,9 @@ def get_subs (names, types):
sdict["@LONG_ARGS@"] = string.join(as_strings,",\n\t")
# So much more readable than string.join(map(string.join,zip(...))))
sdict["@ERROR_ARGS@"] = string.join(map(get_error_arg,types),", ")
+ if cbktypes is not None:
+ sdict["@CBK_ERROR_ARGS@"] = string.join(map(
+ get_error_arg,cbktypes),", ")
return sdict
def generate (tmpl, name, subs):
@@ -732,6 +735,8 @@ def generate (tmpl, name, subs):
if name == "writev":
# More spurious inconsistency.
text = text.replace("@UPNAME@","WRITE")
+ elif name == "readv":
+ text = text.replace("@UPNAME@","READ")
else:
text = text.replace("@UPNAME@",name.upper())
for old, new in subs[name].iteritems():
@@ -747,7 +752,8 @@ for name, args in ops.iteritems():
# Create the necessary substitution strings for fops.
arg_names = [ a[1] for a in args if a[0] == 'fop-arg']
arg_types = [ a[2] for a in args if a[0] == 'fop-arg']
- fop_subs[name] = get_subs(arg_names,arg_types)
+ cbk_types = [ a[2] for a in args if a[0] == 'cbk-arg']
+ fop_subs[name] = get_subs(arg_names,arg_types,cbk_types)
# Same thing for callbacks.
arg_names = [ a[1] for a in args if a[0] == 'cbk-arg']
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 43e6f48d905..5b9f2a45405 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -358,6 +358,22 @@ enum gf_internal_fop_indicator {
} \
} while (0) \
+#define GF_CS_OBJECT_SIZE "trusted.glusterfs.cs.object_size"
+
+#define GF_CS_OBJECT_UPLOAD_COMPLETE "trusted.glusterfs.csou.complete"
+#define GF_CS_OBJECT_REMOTE "trusted.glusterfs.cs.remote"
+#define GF_CS_OBJECT_DOWNLOADING "trusted.glusterfs.cs.downloading"
+#define GF_CS_OBJECT_DOWNLOADED "trusted.glusterfs.cs.downloaded"
+#define GF_CS_OBJECT_STATUS "trusted.glusterfs.cs.status"
+#define GF_CS_OBJECT_REPAIR "trusted.glusterfs.cs.repair"
+
+typedef enum {
+ GF_CS_LOCAL = 1,
+ GF_CS_REMOTE = 2,
+ GF_CS_REPAIR = 4,
+ GF_CS_DOWNLOADING = 8,
+ GF_CS_ERROR = 16,
+} gf_cs_obj_state;
typedef enum {
GF_FOP_PRI_UNSPEC = -1, /* Priority not specified */