116 const RequiredKeys = ...;
120 const RequiredKeysWithHost = RequiredKeys +
"host";
123 const Defaults = ...;
127 const OptionalKeys = ...;
131 const AllKeys = RequiredKeysWithHost + Defaults.keys() + OptionalKeys;
134 const ErrorDelay = 1m;
156 softlist<string> path =
".";
168 bool runflag = False;
337 int getStoreFile(
string remote_path,
string local_path, *timeout n_timeout);
341 string getTextFile(
string path, *timeout n_timeout, *
string n_encoding);
345 binary
getFile(
string path, *timeout n_timeout);
349 rename(
string old,
string nnew, *timeout n_timeout);
357 *hash<Qore::SSH2::Ssh2StatInfo>
stat(
string path, *timeout n_timeout);
382 list<hash<SftpPollerFileEventInfo>>
getFiles(
int sort = SftpPoller::SortNone,
int order = SftpPoller::OrderAsc);
482 static checkPath(
string path,
string type,
bool write = False);
bool runOnce()
runs a single poll (useful for checking for errors inline before starting a background thread)
int port
port
Definition: SftpPoller.qm.dox.h:141
abstract postSingleFileEvent(hash< SftpPollerFileEventInfo > fih)
called after singleFileEvent() for each matching file individually whenever matching files are polled...
abstract singleFileEvent(hash< SftpPollerFileEventInfo > fih)
called for each matching file individually whenever matching files are polled with the list of matchi...
int poll_interval
poll interval in seconds
Definition: SftpPoller.qm.dox.h:165
string host
host or address name
Definition: SftpPoller.qm.dox.h:138
*string pass
password; one of "pass" or "keyfile" *must* be set
Definition: SftpPoller.qm.dox.h:150
static checkPath(string path, string type, bool write=False)
checks a path on the local file system
constructor(hash< auto > nconf)
creates the SftpPoller object from the configuration hash argument passed
stop()
stops the polling operation, returns when the polling operation has been stopped
sftpSleep(softint secs)
sleeps for the specificed number of seconds
*code sleep
optional sleep closure
Definition: SftpPoller.qm.dox.h:216
bool binary
binary transfer flag (for singleFileEvent())
Definition: SftpPoller.qm.dox.h:219
string rootSftpPath
path after connect to SFTP server
Definition: SftpPoller.qm.dox.h:159
rename(string old, string nnew, *timeout n_timeout)
renames a file on the server
binary getFile(string path, *timeout n_timeout)
retrieves a binary file and returns the file's contents
string url
url
Definition: SftpPoller.qm.dox.h:147
Qore::SSH2::SFTPClient sftp
SFTPClient object.
Definition: SftpPoller.qm.dox.h:192
stopNoWait()
stops the polling operation, returns immediately
waitStop()
waits indefinitely for the polling operation to stop; if polling was not in progress then this method...
*code log_debug
optional debug log closure
Definition: SftpPoller.qm.dox.h:210
run()
starts the polling operation
bool writable
chech if path is writable for others in constructor
Definition: SftpPoller.qm.dox.h:222
int start()
starts polling in the background; returns the thread ID of the polling thread
int getStoreFile(string remote_path, string local_path, *timeout n_timeout)
retrieves a remote file and stores it to a local path
*code log_detail
optional detail log closure
Definition: SftpPoller.qm.dox.h:207
string check_file
name of check writable file
Definition: SftpPoller.qm.dox.h:225
logDebug(string fmt)
calls the "log_debug" closure or call reference with verbose debugging information
int tid
polling tid
Definition: SftpPoller.qm.dox.h:183
setMask()
converts a glob mask into a regex
*string keyfile
path to the ssh private key in PEM format; one of "pass" or "keyfile" *must* be set
Definition: SftpPoller.qm.dox.h:153
timeout timeout
timeout in ms
Definition: SftpPoller.qm.dox.h:186
*softint minage
minimum file age
Definition: SftpPoller.qm.dox.h:198
string user
user
Definition: SftpPoller.qm.dox.h:144
constructor(Qore::SSH2::SFTPClient n_sftp, hash< auto > nconf)
creates the SftpPoller object from the SFTPClient argument and configuration hash argument passed
*code log_info
optional info log closure
Definition: SftpPoller.qm.dox.h:204
*bool skip_file_content_retrieval
whether or not to skip the file content retrieval in runOnce()
Definition: SftpPoller.qm.dox.h:228
string getTextFile(string path, *timeout n_timeout, *string n_encoding)
retrieves a text file and returns the file's contents
bool get_files
internal "get files" flag
Definition: SftpPoller.qm.dox.h:171
list< hash< SftpPollerFileEventInfo > > getFiles(int sort=SftpPoller::SortNone, int order=SftpPoller::OrderAsc)
returns a list of regular file hashes matching any file name mask set for the object
*string encoding
file encoding for text files
Definition: SftpPoller.qm.dox.h:201
*bool fileEvent(list< hash< SftpPollerFileEventInfo > > l)
called for each poll with a list of all files matched before transfer; if this method returns False o...
startInline()
starts the polling operation inline (not in a background thread)
logInfo(string fmt)
calls the "log_info" closure or call reference with important information
*code start_thread
optional start thread closure
Definition: SftpPoller.qm.dox.h:213
removeFile(string fn, *timeout n_timeout)
deletes a file on the server
*string mask
file glob name mask (ignored if "regex_mask" also set)
Definition: SftpPoller.qm.dox.h:162
logDetail(string fmt)
calls the "log_detail" closure or call reference with detail information
checkRemotePath(string path, bool write=False, *timeout n_timeout)
check if a remote path is writable
destructor()
stops the polling operation if in progress and destroys the object
int getPollCount()
returns the current poll count
*hash< Qore::SSH2::Ssh2StatInfo > stat(string path, *timeout n_timeout)
returns information about a remote file (see Qore::SSH2::SFTPClient::stat() for a description of the ...
main SftpPoller namespace