pike.git / lib / modules / Filesystem.pmod / Monitor.pmod / basic.pike

version» Context lines:

pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:130:   //! Path of the file or directory.   //!   //! @param st   //! Status information for @[path] as obtained by @expr{file_stat(path, 1)@}.   //!   //! This function is called during initialization for all monitored paths,   //! and subpaths for monitored directories. It represents the initial state   //! for the monitor.   //!   //! @note - //! For directories, @[file_created()] will be called for the subpaths + //! For directories, @[file_exists()] will be called for the subpaths   //! before the call for the directory itself. This can be used to detect   //! when the initialization for a directory is finished.   //!   //! Called by @[check()] and @[check_monitor()] the first time a monitored   //! path is checked (and only if it exists).   //!   //! Overload this to do something useful. -  + //! + //! @note + //! This callback has similar semantics to @[file_created()], but + //! is called at initialization time. + //! + //! @seealso + //! @[file_created()], @[file_deleted()], @[stable_data_change()]   void file_exists(string path, Stdio.Stat st);      //! File creation callback.   //!   //! @param path   //! Path of the new file or directory.   //!   //! @param st   //! Status information for @[path] as obtained by @expr{file_stat(path, 1)@}.   //!   //! This function is called when either a monitored path has started   //! existing, or when a new file or directory has been added to a   //! monitored directory.   //!   //! Called by @[check()] and @[check_monitor()].   //!   //! Overload this to do something useful. -  + //! + //! @note + //! This callback has similar semantics to @[file_exists()], but + //! is called at run time. + //! + //! @seealso + //! @[file_exists()], @[file_deleted()], @[stable_data_change()]   void file_created(string path, Stdio.Stat st);      //! File deletion callback.   //!   //! @param path   //! Path of the new file or directory that has been deleted.   //!   //! This function is called when either a monitored path has stopped   //! to exist, or when a file or directory has been deleted from a   //! monitored directory.   //!   //! Called by @[check()] and @[check_monitor()].   //!   //! Overload this to do something useful. -  + //! + //! @seealso + //! @[file_created()], @[file_exists()], @[stable_data_change()]   void file_deleted(string path);      //! Stable change callback.   //!   //! @param path   //! Path of the file or directory that has stopped changing.   //!   //! @param st   //! Status information for @[path] as obtained by @expr{file_stat(path, 1)@}.   //!   //! This function is called when previous changes to @[path] are   //! considered "stable".   //!   //! "Stable" in this case means that there have been no detected   //! changes for at lease @[stable_time] seconds.   //!   //! Called by @[check()] and @[check_monitor()].   //!   //! Overload this to do something useful. -  + //! + //! @note + //! This callback being called does not mean that the contents + //! or inode has changed, just that they don't seem to change any + //! more. In particular it is called for paths found during + //! initialization after @[stable_time] seconds have passed. + //! + //! @seealso + //! @[file_created()], @[file_exists()], @[file_deleted()]   void stable_data_change(string path, Stdio.Stat st);      //! Flags for @[Monitor]s.   enum MonitorFlags {    MF_RECURSE = 1,    MF_AUTO = 2,    MF_INITED = 4,    MF_HARD = 8,   };   
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:314:    //!    //! @param st    //! Status information for @[path] as obtained by    //! @expr{file_stat(path, 1)@}.    //!    //! This function is called when a change has been detected for an    //! attribute for a monitored file or directory.    //!    //! Called by @[check()] and @[check_monitor()].    //! +  //! The default implementation calls @[global::attr_changed()] or +  //! @[global::data_changed()] depending on the state. +  //!    //! @note    //! If there is a @[data_changed()] callback, it may supersede this    //! callback if the file content also has changed.    protected void attr_changed(string path, Stdio.Stat st)    {    MON_WERR("attr_changed(%O, %O)\n", path, st);    if (global::data_changed) {    call_callback(global::data_changed, path);    } else {    call_callback(global::attr_changed, path, st);
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:344:    //! and subpaths for monitored directories. It represents the initial state    //! for the monitor.    //!    //! @note    //! For directories, @[file_created()] will be called for the subpaths    //! before the call for the directory itself. This can be used to detect    //! when the initialization for a directory is finished.    //!    //! Called by @[check()] and @[check_monitor()] the first time a monitored    //! path is checked (and only if it exists). +  //! +  //! The default implementation registers the path, and +  //! calls @[global::file_exists()]. +  //! +  //! @note +  //! This callback has similar semantics to @[file_created()], but +  //! is called at initialization time. +  //! +  //! @seealso +  //! @[file_created()], @[file_deleted()], @[stable_data_change()]    protected void file_exists(string path, Stdio.Stat st)    {    MON_WERR("file_exists(%O, %O)\n", path, st);    register_path();    int t = time(1);    call_callback(global::file_exists, path, st);    if (st->mtime + (stable_time || global::stable_time) >= t) {    // Not stable yet! We guess that the mtime is a    // fair indication of when the file last changed.    last_change = st->mtime;
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:368:    //!    //! @param st    //! Status information for @[path] as obtained by    //! @expr{file_stat(path, 1)@}.    //!    //! This function is called when either a monitored path has started    //! existing, or when a new file or directory has been added to a    //! monitored directory.    //!    //! Called by @[check()] and @[check_monitor()]. +  //! +  //! The default implementation registers the path, and +  //! calls @[global::file_deleted()]. +  //! +  //! @note +  //! This callback has similar semantics to @[file_exists()], but +  //! is called at run time. +  //! +  //! @seealso +  //! @[file_exists()], @[file_deleted()], @[stable_data_change()]    protected void file_created(string path, Stdio.Stat st)    {    MON_WERR("file_created(%O, %O)\n", path, st);    register_path();    call_callback(global::file_created, path, st);    }       //! File deletion callback.    //!    //! @param path
pike.git/lib/modules/Filesystem.pmod/Monitor.pmod/basic.pike:389:    //!    //! @param old_st    //! Stat for the file prior to deletion (if known). Note that    //! this argument is not passed along to top level function.    //!    //! This function is called when either a monitored path has stopped    //! to exist, or when a file or directory has been deleted from a    //! monitored directory.    //!    //! Called by @[check()] and @[check_monitor()]. +  //! +  //! The default implementation unregisters the path, and +  //! calls @[global::file_deleted()]. +  //! +  //! @seealso +  //! @[file_created()], @[file_exists()], @[stable_data_change()]    protected void file_deleted(string path, Stdio.Stat|void old_st)    {    MON_WERR("file_deleted(%O, %O)\n", path, st);    unregister_path();    call_callback(global::file_deleted, path);    }       //! Stable change callback.    //!    //! @param st    //! Status information for @[path] as obtained by    //! @expr{file_stat(path, 1)@}.    //!    //! This function is called when previous changes to @[path] are    //! considered "stable".    //!    //! "Stable" in this case means that there have been no detected    //! changes for at lease @[stable_time] seconds.    //!    //! Called by @[check()] and @[check_monitor()]. -  +  //! +  //! The default implementation calls @[global::stable_data_change()]. +  //! +  //! @note +  //! This callback being called does not mean that the contents +  //! or inode has changed, just that they don't seem to change any +  //! more. In particular it is called for paths found during +  //! initialization after @[stable_time] seconds have passed. +  //! +  //! @seealso +  //! @[file_created()], @[file_exists()], @[file_deleted()]    protected void stable_data_change(string path, Stdio.Stat st)    {    MON_WERR("stable_data_change(%O, %O)\n", path, st);    call_callback(global::stable_data_change, path, st);    }       protected string _sprintf(int c)    {    return sprintf("Monitor(%O, %O, next: %s, st: %O)",    path, flags, ctime(next_poll) - "\n", st);