io.hh (fstransform-0.9.3-src) | : | io.hh (fstransform-0.9.4) | ||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
#ifndef FSMOVE_IO_IO_HH | #ifndef FSMOVE_IO_IO_HH | |||
#define FSMOVE_IO_IO_HH | #define FSMOVE_IO_IO_HH | |||
#include "../check.hh" | #include "../check.hh" | |||
#include "../types.hh" // for ft_string, ft_uoff | #include "../types.hh" // for ft_string, ft_uoff | |||
#include "../eta.hh" // for ft_eta | #include "../eta.hh" // for ft_eta | |||
#include "../log.hh" // for ft_log_level, also for ff_log() used by io.c c | #include "../log.hh" // for ft_log_level, also for ff_log() used by io.c c | |||
#include "../fwd.hh" // for fm_args | #include "../fwd.hh" // for fm_args | |||
#include "../inode_cache.hh" // for fm_inode_cache | #include "../cache/cache.hh" // for ft_cache<K,V> | |||
#include "disk_stat.hh" // for fm_disk_stat | #include "disk_stat.hh" // for fm_disk_stat | |||
#include <set> // for std::set | #include <set> // for std::set | |||
FT_IO_NAMESPACE_BEGIN | FT_IO_NAMESPACE_BEGIN | |||
/** | /** | |||
* abstract base class for all I/O implementations | * abstract base class for all I/O implementations | |||
* that actually move files around | * that actually move files around | |||
*/ | */ | |||
class fm_io { | class fm_io { | |||
private: | private: | |||
fm_inode_cache this_inode_cache; | ft_cache<ft_inode, ft_string> * this_inode_cache; | |||
std::set<ft_string> this_exclude_set; | std::set<ft_string> this_exclude_set; | |||
fm_disk_stat this_source_stat, this_target_stat; | fm_disk_stat this_source_stat, this_target_stat; | |||
ft_string this_source_root, this_target_root; | ft_string this_source_root, this_target_root; | |||
ft_eta this_eta; | ft_eta this_eta; | |||
ft_uoff this_work_total, this_work_report_threshold; | ft_uoff this_work_total, this_work_report_threshold; | |||
ft_uoff this_work_done, this_work_last_reported; | ft_uoff this_work_done, this_work_last_reported; | |||
double this_work_last_reported_time; | double this_work_last_reported_time; | |||
bool this_force_run, this_simulate_run; | const char * this_progress_msg; | |||
enum fm_source_or_target { FC_SOURCE, FC_TARGET }; | bool this_force_run, this_simulate_run; | |||
/** | /** | |||
* returns error if source or target file-system are almost full (typical th reshold is 97%) | * returns error if source or target file-system are almost full (typical th reshold is 97%) | |||
*/ | */ | |||
int is_almost_full(const fm_disk_stat & stat) const; | int is_almost_full(const fm_disk_stat & stat) const; | |||
protected: | protected: | |||
FT_INLINE const ft_string * inode_cache_find_or_add(ft_inode inode, const ft | int inode_cache_find_or_add(ft_inode inode, ft_string & path); | |||
_string & path) { | ||||
return this_inode_cache.find_or_add(inode, path); | int inode_cache_find_and_delete(ft_inode inode, ft_string & path); | |||
} | ||||
FT_INLINE const ft_string * inode_cache_find(ft_inode inode, const ft_string | ||||
& path) const { | ||||
return this_inode_cache.find(inode, path); | ||||
} | ||||
FT_INLINE void inode_cache_erase(ft_inode inode) { | ||||
this_inode_cache.erase(inode); | ||||
} | ||||
FT_INLINE fm_disk_stat & source_stat() { return this_source_stat; } | FT_INLINE fm_disk_stat & source_stat() { return this_source_stat; } | |||
FT_INLINE fm_disk_stat & target_stat() { return this_target_stat; } | FT_INLINE fm_disk_stat & target_stat() { return this_target_stat; } | |||
FT_INLINE void progress_msg(const char * msg) { this_progress_msg = msg; } | ||||
/** | /** | |||
* use source_stat and target_stat to compute total number of bytes to move | * use source_stat and target_stat to compute total number of bytes to move | |||
* (may include estimated overhead for special files, inodes...), | * (may include estimated overhead for special files, inodes...), | |||
* reset total number of bytes moved, | * reset total number of bytes moved, | |||
* initialize this_eta to 0% at current time | * initialize this_eta to 0% at current time | |||
* | * | |||
* returns error if source or target file-system are almost full (typical th reshold is 97%) | * returns error if source or target file-system are almost full (typical th reshold is 97%) | |||
*/ | */ | |||
int init_work(); | int init_work(); | |||
End of changes. 6 change blocks. | ||||
15 lines changed or deleted | 9 lines changed or added |