Pyro higlevel API
|
Filesystem node monitor. More...
Classes | |
class | Private |
Public Member Functions | |
NodeMonitor () | |
NodeMonitor (const String &cPath, uint32 nFlags, const Handler *pcHandler, const Looper *pcLooper=NULL) | |
NodeMonitor (const String &cPath, uint32 nFlags, const Messenger &cTarget) | |
NodeMonitor (const Directory &cDir, const String &cPath, uint32 nFlags, const Handler *pcHandler, const Looper *pcLooper=NULL) | |
NodeMonitor (const Directory &cDir, const String &cPath, uint32 nFlags, const Messenger &cTarget) | |
NodeMonitor (const FileReference &cRef, uint32 nFlags, const Handler *pcHandler, const Looper *pcLooper=NULL) | |
NodeMonitor (const FileReference &cRef, uint32 nFlags, const Messenger &cTarget) | |
NodeMonitor (const FSNode *pcNode, uint32 nFlags, const Handler *pcHandler, const Looper *pcLooper=NULL) | |
NodeMonitor (const FSNode *pcNode, uint32 nFlags, const Messenger &cTarget) | |
~NodeMonitor () | |
bool | IsValid () const |
status_t | Unset () |
status_t | SetTo (const String &cPath, uint32 nFlags, const Handler *pcHandler, const Looper *pcLooper=NULL) |
status_t | SetTo (const String &cPath, uint32 nFlags, const Messenger &cTarget) |
status_t | SetTo (const Directory &cDir, const String &cPath, uint32 nFlags, const Handler *pcHandler, const Looper *pcLooper=NULL) |
status_t | SetTo (const Directory &cDir, const String &cPath, uint32 nFlags, const Messenger &cTarget) |
status_t | SetTo (const FileReference &cRef, uint32 nFlags, const Handler *pcHandler, const Looper *pcLooper=NULL) |
status_t | SetTo (const FileReference &cRef, uint32 nFlags, const Messenger &cTarget) |
status_t | SetTo (const FSNode *pcNode, uint32 nFlags, const Handler *pcHandler, const Looper *pcLooper=NULL) |
status_t | SetTo (const FSNode *pcNode, uint32 nFlags, const Messenger &cTarget) |
int | GetMonitor () const |
You can monitor file creations and deletions as well as file renaming inside a directory. You can also monitor a file or directory for changes to the attributes or stat info (size, time-stamps, etc etc).
A node monitor will produce asyncronous events that will be sendt to a os::Looper whenever a relevant change is made to the node it is monitoring. When creating a NodeMonitor you must provide a bit-mask telling what event's you are interrested in and what os::Looper/os::Handler should receive the event message.
Here is a list of the flags controlling what to monitor:
When a relevant change happens to the filesystem one of the following messages are sendt to the target of the monitor:
All messages contain at least 3 elements:
Field | Type | Description |
"event" | T_INT32 | One of the NWEVENT_* event codes |
"device" | T_INT32 | The dev_t device number of the FS containing the affected node(s) |
"node" | T_INT64 | The ino_t i-node number of the affected node |
NWEVENT_CREATED
Sendt when a file is created in a directory watched with NWATCH_DIR.
Field | Type | Description |
"event" | T_INT32 | NWEVENT_CREATED |
"device" | T_INT32 | The dev_t device number of the FS where the file was created. |
"node" | T_INT64 | The ino_t i-node number of the new node |
"dir_node" | T_INT64 | The ino_t of the directory where the node was created. |
"name" | T_STRING | The name of the new node |
NWEVENT_DELETED
Sendt when a file watched with NWATCH_NAME or that lives in a directory watched with NWATCH_DIR is deleted.
Field | Type | Description |
"event" | T_INT32 | NWEVENT_DELETED |
"device" | T_INT32 | The dev_t device number of the FS where the file was deleted. |
"node" | T_INT64 | The ino_t i-node number of the node that was deleted. |
"dir_node" | T_INT64 | The ino_t of the directory from where the node was deleted. |
"name" | T_STRING | The name of the deleted node |
NWEVENT_MOVED
Sendt when a file watched with NWATCH_NAME or that lives in a directory watched with NWATCH_DIR is deleted.
Field | Type | Description |
"event" | T_INT32 | NWEVENT_MOVED |
"device" | T_INT32 | The dev_t device number of the FS containing the moved/renamed file. |
"node" | T_INT64 | The ino_t i-node number of the node that was moved/renamed. |
"old_dir" | T_INT64 | The ino_t i-node number of the directory the file was moved from. |
"new_dir" | T_INT64 | The ino_t i-node number of the directory the file was moved to. If this is the same as "old_dir" the file was only renamed and not moved. |
"name" | T_STRING | The new file name. |
"old_path" | T_STRING | Only present if the NWATCH_FULL_DST_PATH was set and the file was moved into a directory watched with NWATCH_DIR. The string contain the full path of the directory the file was moved from. |
"new_path" | T_STRING | Only present if the NWATCH_FULL_DST_PATH was set and the file was moved out of a directory watched with NWATCH_DIR or the moved/renamed file itself was watched with NWATCH_NAME (and NWATCH_FULL_DST_PATH) |
NodeMonitor::NodeMonitor | ( | ) |
NodeMonitor::NodeMonitor | ( | const String & | cPath, |
uint32 | nFlags, | ||
const Handler * | pcHandler, | ||
const Looper * | pcLooper = NULL |
||
) |
References os::NodeMonitor::Private::m_nMonitor.
References os::NodeMonitor::Private::m_nMonitor.
NodeMonitor::NodeMonitor | ( | const Directory & | cDir, |
const String & | cPath, | ||
uint32 | nFlags, | ||
const Handler * | pcHandler, | ||
const Looper * | pcLooper = NULL |
||
) |
References os::FSNode::IsValid(), and os::NodeMonitor::Private::m_nMonitor.
NodeMonitor::NodeMonitor | ( | const Directory & | cDir, |
const String & | cPath, | ||
uint32 | nFlags, | ||
const Messenger & | cTarget | ||
) |
References os::FSNode::IsValid(), and os::NodeMonitor::Private::m_nMonitor.
NodeMonitor::NodeMonitor | ( | const FileReference & | cRef, |
uint32 | nFlags, | ||
const Handler * | pcHandler, | ||
const Looper * | pcLooper = NULL |
||
) |
References os::FileReference::IsValid(), and os::NodeMonitor::Private::m_nMonitor.
NodeMonitor::NodeMonitor | ( | const FileReference & | cRef, |
uint32 | nFlags, | ||
const Messenger & | cTarget | ||
) |
References os::FileReference::IsValid(), and os::NodeMonitor::Private::m_nMonitor.
NodeMonitor::NodeMonitor | ( | const FSNode * | pcNode, |
uint32 | nFlags, | ||
const Handler * | pcHandler, | ||
const Looper * | pcLooper = NULL |
||
) |
References os::FSNode::IsValid(), and os::NodeMonitor::Private::m_nMonitor.
References os::FSNode::IsValid(), and os::NodeMonitor::Private::m_nMonitor.
NodeMonitor::~NodeMonitor | ( | ) |
References os::NodeMonitor::Private::m_nMonitor.
int NodeMonitor::GetMonitor | ( | ) | const |
References os::NodeMonitor::Private::m_nMonitor.
bool os::NodeMonitor::IsValid | ( | ) | const |
status_t NodeMonitor::SetTo | ( | const String & | cPath, |
uint32 | nFlags, | ||
const Handler * | pcHandler, | ||
const Looper * | pcLooper = NULL |
||
) |
Referenced by os_priv::DirKeeper::DirKeeper(), os_priv::DirKeeper::HandleMessage(), and SetTo().
References os::NodeMonitor::Private::m_nMonitor.
status_t NodeMonitor::SetTo | ( | const Directory & | cDir, |
const String & | cPath, | ||
uint32 | nFlags, | ||
const Handler * | pcHandler, | ||
const Looper * | pcLooper = NULL |
||
) |
References SetTo().
status_t NodeMonitor::SetTo | ( | const Directory & | cDir, |
const String & | cPath, | ||
uint32 | nFlags, | ||
const Messenger & | cTarget | ||
) |
References os::FSNode::IsValid(), and os::NodeMonitor::Private::m_nMonitor.
status_t NodeMonitor::SetTo | ( | const FileReference & | cRef, |
uint32 | nFlags, | ||
const Handler * | pcHandler, | ||
const Looper * | pcLooper = NULL |
||
) |
References SetTo().
status_t NodeMonitor::SetTo | ( | const FileReference & | cRef, |
uint32 | nFlags, | ||
const Messenger & | cTarget | ||
) |
References os::FileReference::IsValid(), and os::NodeMonitor::Private::m_nMonitor.
status_t NodeMonitor::SetTo | ( | const FSNode * | pcNode, |
uint32 | nFlags, | ||
const Handler * | pcHandler, | ||
const Looper * | pcLooper = NULL |
||
) |
References SetTo().
References os::FSNode::IsValid(), and os::NodeMonitor::Private::m_nMonitor.
status_t NodeMonitor::Unset | ( | ) |
References os::NodeMonitor::Private::m_nMonitor.
Referenced by os_priv::DirKeeper::HandleMessage(), and os_priv::DirKeeper::Stop().