summaryrefslogtreecommitdiffstats
path: root/xlators/features/snapview-server/src/snapview-server.h
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2014-06-17 00:28:01 +0530
committerVijay Bellur <vbellur@redhat.com>2014-09-08 07:14:19 -0700
commit822cf315a5d0f0d2bc90e9f2d8faa6e5e5701ed4 (patch)
treec386b9c054c86b033cf1945dc7ce3c7a3af687e9 /xlators/features/snapview-server/src/snapview-server.h
parent5c869aea79c0f304150eac014c7177e74ce0852e (diff)
snapview-server: register a callback with glusterd to get notifications
* As of now snapview-server is polling (sending rpc requests to glusterd) to get the latest list of snapshots at some regular time intervals (non configurable). Instead of that register a callback with glusterd so that glusterd sends notifications to snapd whenever a snapshot is created/deleted and snapview-server can configure itself. Change-Id: I17a274fd2ab487d030678f0077feb2b0f35e5896 BUG: 1119628 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/8150 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/snapview-server/src/snapview-server.h')
-rw-r--r--xlators/features/snapview-server/src/snapview-server.h81
1 files changed, 60 insertions, 21 deletions
diff --git a/xlators/features/snapview-server/src/snapview-server.h b/xlators/features/snapview-server/src/snapview-server.h
index 510599c3650..e689e4981a0 100644
--- a/xlators/features/snapview-server/src/snapview-server.h
+++ b/xlators/features/snapview-server/src/snapview-server.h
@@ -38,6 +38,8 @@
#include "timer.h"
#include "rpc-clnt.h"
#include "protocol-common.h"
+#include "xdr-generic.h"
+
#define DEFAULT_SVD_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs"
@@ -51,6 +53,7 @@
STACK_DESTROY (((call_frame_t *)_frame)->root); \
} while (0)
+
int
svs_mgmt_submit_request (void *req, call_frame_t *frame,
glusterfs_ctx_t *ctx,
@@ -64,22 +67,6 @@ int
mgmt_get_snapinfo_cbk (struct rpc_req *req, struct iovec *iov,
int count, void *myframe);
-char *clnt_handshake_procs[GF_HNDSK_MAXVALUE] = {
- [GF_HNDSK_NULL] = "NULL",
- [GF_HNDSK_SETVOLUME] = "SETVOLUME",
- [GF_HNDSK_GETSPEC] = "GETSPEC",
- [GF_HNDSK_PING] = "PING",
- [GF_HNDSK_EVENT_NOTIFY] = "EVENTNOTIFY",
-};
-
-rpc_clnt_prog_t svs_clnt_handshake_prog = {
- .progname = "GlusterFS Handshake",
- .prognum = GLUSTER_HNDSK_PROGRAM,
- .progver = GLUSTER_HNDSK_VERSION,
- .procnames = clnt_handshake_procs,
-};
-
-
typedef enum {
SNAP_VIEW_ENTRY_POINT_INODE = 0,
SNAP_VIEW_VIRTUAL_INODE
@@ -116,17 +103,69 @@ struct svs_private {
int num_snaps;
char *volname;
struct list_head snaplist;
- pthread_mutex_t snaplist_lock;
- uint32_t is_snaplist_done;
- gf_timer_t *snap_timer;
- pthread_attr_t thr_attr;
+ gf_lock_t snaplist_lock;
+ struct rpc_clnt *rpc;
};
typedef struct svs_private svs_private_t;
+int
+__svs_inode_ctx_set (xlator_t *this, inode_t *inode, svs_inode_t *svs_inode);
+
+svs_inode_t *
+__svs_inode_ctx_get (xlator_t *this, inode_t *inode);
+
+svs_inode_t *
+svs_inode_ctx_get (xlator_t *this, inode_t *inode);
+
+int32_t
+svs_inode_ctx_set (xlator_t *this, inode_t *inode, svs_inode_t *svs_inode);
+
+svs_inode_t *
+svs_inode_new ();
+
+svs_inode_t *
+svs_inode_ctx_get_or_new (xlator_t *this, inode_t *inode);
+
+svs_fd_t *
+svs_fd_new ();
+
+int
+__svs_fd_ctx_set (xlator_t *this, fd_t *fd, svs_fd_t *svs_fd);
+
+svs_fd_t *
+__svs_fd_ctx_get (xlator_t *this, fd_t *fd);
+
+svs_fd_t *
+svs_fd_ctx_get (xlator_t *this, fd_t *fd);
+
+int32_t
+svs_fd_ctx_set (xlator_t *this, fd_t *fd, svs_fd_t *svs_fd);
+
+svs_fd_t *
+__svs_fd_ctx_get_or_new (xlator_t *this, fd_t *fd);
+
+svs_fd_t *
+svs_fd_ctx_get_or_new (xlator_t *this, fd_t *fd);
+
+void
+svs_fill_ino_from_gfid (struct iatt *buf);
+
+void
+svs_iatt_fill (uuid_t gfid, struct iatt *buf);
+
+snap_dirent_t *
+svs_get_latest_snap_entry (xlator_t *this);
+
glfs_t *
-svs_intialise_snapshot_volume (xlator_t *this, const char *name);
+svs_get_latest_snapshot (xlator_t *this);
+
+glfs_t *
+svs_initialise_snapshot_volume (xlator_t *this, const char *name);
snap_dirent_t *
svs_get_snap_dirent (xlator_t *this, const char *name);
+int
+svs_mgmt_init (xlator_t *this);
+
#endif /* __SNAP_VIEW_H__ */