summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2024-02-16 14:54:24 +0900
committerRyo Nakamura <upa@haeena.net>2024-02-17 12:39:19 +0900
commitf71c7a145a4c840baff1d34e9d2c3d9e2f26d74e (patch)
tree0931150b21c7e9e883437dccc212c4206c43db5f /include
parent4e895bb72e035c7c5034dd8beca7c8497413ad9e (diff)
add checkpoint.c and .h
Diffstat (limited to 'include')
-rw-r--r--include/config.h.in7
-rw-r--r--include/mscp.h30
2 files changed, 26 insertions, 11 deletions
diff --git a/include/config.h.in b/include/config.h.in
index 86c6a24..972723a 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -15,11 +15,4 @@
/* Define to 1 if you have the ntohll function. */
#cmakedefine HAVE_NTOHLL 1
-/* Define to 1 if you have the bswap_64 function. */
-#cmakedefine HAVE_BSWAP_64 1
-
-/* Define to 1 if you have the bswap64 function. */
-#cmakedefine HAVE_BSWAP64 1
-
-
#endif /* _CONFIG_H_ */
diff --git a/include/mscp.h b/include/mscp.h
index 8f69c1e..c6af3f8 100644
--- a/include/mscp.h
+++ b/include/mscp.h
@@ -45,7 +45,8 @@ struct mscp_opts {
int max_startups; /** sshd MaxStartups concurrent connections */
int interval; /** interval between SSH connection attempts */
bool preserve_ts; /** preserve file timestamps */
-
+ char *checkpoint; /** path to checkpoint */
+ int resume; /** resume from checkpoint if > 0 */
int severity; /** messaging severity. set MSCP_SERVERITY_* */
};
@@ -162,9 +163,9 @@ int mscp_set_dst_path(struct mscp *m, const char *dst_path);
int mscp_scan(struct mscp *m);
/**
- * @brief Join scna thread invoked by mscp_scan(). mscp_join()
- * involves this, so that mscp_scan_join() should be called when
- * mscp_scan() is called by mscp_start() is not.
+ * @brief Join scan thread invoked by mscp_scan() if it
+ * runs. mscp_join() involves mscp_can_join(). Thus, there is no need
+ * to call this function alone.
*
* @param m mscp instance.
* @return 0 on success, < 0 if an error occured.
@@ -172,6 +173,27 @@ int mscp_scan(struct mscp *m);
int mscp_scan_join(struct mscp *m);
/**
+ * @brief resume transfer from a checkpoint. mscp_load_checkpoint()
+ * loads files and associated chunks from a checkpoint file pointed by
+ * pathname. If you call mscp_load_checkpoint, do not call
+ * mscp_scan().
+ *
+ * @param m mscp instance.
+ * @param pathname path to a checkpoint file.
+ * @return 0 on success, < 0 if an error occured.
+ */
+int mscp_load_checkpoint(struct mscp *m, const char *pathname);
+
+/**
+ * @brief save untransferred files and chunks to a checkpoint file.
+ *
+ * @param m mscp instance.
+ * @param pathname path to a checkpoint file.
+ * @return 0 on success, < 0 if an error occured.
+ */
+int mscp_save_checkpoint(struct mscp *m, const char *pathname);
+
+/**
* @brief Start to copy files. mscp_start() returns immediately. You
* can get statistics via mscp_get_stats() or messages via pipe set by
* mscp_opts.msg_fd or mscp_set_msg_fd(). mscp_stop() cancels mscp