|
| VFS (QString configFile, QStringList plugins=QStringList(), bool describe=false, bool printConfig=false) |
| The VFS constructor will create a VFS based on an incoming config file and list of plugins. More...
|
|
| ~VFS () |
| Destroy the VFS node, which will remove references to logging nodes and return output to cp_init color scheme. More...
|
|
void | getLogSettings (int &loglevel, int &logtime) |
| Get the loglevel and logtime values for the logger. More...
|
|
Q_INVOKABLE | VFS_node () |
| The VFS_node constructor will add its instance to the VFS_node::__allNodes global node registry, observing thread safety rules. More...
|
|
virtual | ~VFS_node () |
| VFS_node destructor. More...
|
|
virtual VFS_node * | append (QString name, VFS_node *node, bool containerCheck=true, QString user="server") |
| Append a VFS_node as a child of this node. More...
|
|
QString | className () |
| Return the class name of a node. More...
|
|
virtual VFS_request * | createRequest (VFS_request::requestType type, QString path, QString user="unknown", QJsonDocument data=QJsonDocument(), QJsonObject metadata=QJsonObject(), bool dontDelete=false) |
| Create a new VFS_request with this object as _origin. More...
|
|
VFS_node * | find (QString path) |
| Find a node by string path. More...
|
|
virtual VFS_node * | find (VFS_request *r) |
| Find a node using a VFS_request. More...
|
|
VFS_node * | findChildWithName (QString name) |
| Check if a child with a given name exists. More...
|
|
virtual bool | isContainer () |
| A VFS_node may have children. More...
|
|
virtual VFS_node * | mount () |
| Mount this node. More...
|
|
virtual QString | reportDetails () |
| Additional details for a generated report. More...
|
|
QString | uniqueChildName (QString name) |
| Generate a unique child name. More...
|
|
virtual VFS_node * | unmount () |
| Unmount this node. More...
|
|
virtual bool | validChildName (QString name) |
| Check if a node name is valid. More...
|
|
|
static void | CRITICAL (QString message) |
| Send a message to the VFS::_critical VFS_stream. More...
|
|
static void | ERROR (QString message, int level=0, QString user="server") |
| Send a message to the VFS::_errors VFS_stream. More...
|
|
static void | LOG (QString message, int level=0, QString user="server") |
| Send a message to the VFS::_messages VFS_stream. More...
|
|
static QJsonDocument | parameters () |
| Fetch the parameters assigned to this VFS, as per the config file. More...
|
|
static VFS * | root () |
| Return the root node of the VFS filesystem. More...
|
|
static qint64 | starttime () |
| Get the epoch start time of this VFS instance, in milliseconds. More...
|
|
static qint64 | uptime () |
| Get the uptime of this VFS instance, in milliseconds. More...
|
|
static QString | uptimeString (bool ms=true) |
| Get the uptime of this VFS instance as a string. More...
|
|
static void | WARN (QString message, int level=0, QString user="server") |
| Send a message to the VFS::_warnings VFS_stream. More...
|
|
static bool | __isNode (VFS_node *) |
| Check to see if a node is in the global registry. More...
|
|
static QString | code (QString nodename, QString libname, QString &error) |
| Fetch code or any other resource from a node. More...
|
|
|
virtual QByteArray | icon () |
| Fetch the icon for this node. More...
|
|
virtual void | aclDefaults (VFS_request *r) |
| Return default values and features associated wth this node. More...
|
|
void | addACLDefault (QJsonObject &acl, bool value, QString description="") |
| Add a default value to the acl object. More...
|
|
void | addACLFeature (QJsonObject &acl, QString feature, bool value, QString description="") |
| Add a feature to the acl object. More...
|
|
void | addACLFeatureGroup (QJsonObject &acl, QString feature, QString group, bool value) |
| Add a feature group to the acl object. More...
|
|
void | addACLFeatureUser (QJsonObject &acl, QString feature, QString user, bool value) |
| Add a feature user to the acl object. More...
|
|
void | addACLGroup (QJsonObject &acl, QString group, bool value) |
| Add a group to the acl object. More...
|
|
void | addACLUser (QJsonObject &acl, QString user, bool value) |
| Add a user to the acl object. More...
|
|
virtual void | issueRequest (VFS_node *target, VFS_request *t) |
| Issue a VFS_request to its target. More...
|
|
virtual void | issueRequest (VFS_request *t) |
| A convenience function. More...
|
|
virtual void | issueResponse (VFS_request *t) |
| Once a request has been completed, issue a response. More...
|
|
virtual void | ls (VFS_request *r) |
| List the contents of this node. More...
|
|
virtual void | metadata (VFS_request *r) |
| Fetch the metadata of this node. More...
|
|
virtual void | read (VFS_request *r) |
| Return the data contents of this node, or if it's a container call ls() More...
|
|
virtual void | releaseLock (VFS_request *r) |
| Release a lock on this node. More...
|
|
virtual void | report (VFS_request *r) |
| Report debugging information about the current state of this node. More...
|
|
virtual void | requestLock (VFS_request *r) |
| Request a lock on this node. More...
|
|
virtual void | rm (VFS_request *r) |
| Remove a child entry from a node, or the node itself. More...
|
|
virtual void | submit (VFS_request *r) |
| Submit a diff to a node. More...
|
|
virtual void | subscribe (VFS_request *r) |
| Add an entry to this node's _subscription list. More...
|
|
virtual void | unsubscribe (VFS_request *r) |
| Remove an entry from this node's _subscription list. More...
|
|
virtual void | unsubscribePath (QString path) |
| Unsubscribe all references to a subpath. More...
|
|
virtual void | write (VFS_request *r) |
| Write data to this node. More...
|
|
|
VFS_thread * | _logger |
| The VFS_logger instance, which will always be on another thread. More...
|
|
int | _logLevel |
| Filter log entries by this value... lower entries are very important, higher ones are more fine-grained. More...
|
|
int | _logTime |
| Include log entry time in output, where 0 = none, 1 = locale time, 2 = locale time and date, 3 = UTC time date and offset. More...
|
|
int | _monitorTimerID |
| The timerID for monitoring config file changes. More...
|
|
QMutex | _printLock |
| A lock for ensuring that print messags don't get interleaved. More...
|
|
qint64 | _start |
| Set when the VFS instance begins. This is used to track uptime. More...
|
|
ColorPrint | cp_bold |
| Color settings for bold printing. More...
|
|
ColorPrint | cp_error |
| Color settings for error messages. More...
|
|
ColorPrint | cp_init |
| Color settings to print messages when other streams do not exist. More...
|
|
ColorPrint | cp_warn |
| Color settings for warning messages. More...
|
|
VFS is the root node for a Virtual Filesystem.
There should only be one VFS in a running executable, probably created in main(). The VFS root node is an access point for path requests, searches, logging, and stdout/stderr output.
Definition at line 14 of file VFS.h.
VFS::VFS |
( |
QString |
configFile, |
|
|
QStringList |
plugins = QStringList() , |
|
|
bool |
describe = false , |
|
|
bool |
printConfig = false |
|
) |
| |
The VFS constructor will create a VFS based on an incoming config file and list of plugins.
- Parameters
-
configFile | The path to a config file |
plugins | The list of plugin paths to search |
describe | If set to true, don't start the VFS but instead list information about the plugins that have been loaded. |
printConfig | A debug setting, used to make sure contexts are correct |
A VFS_logger is created. VFS_creator::init() and VFS_creator::build() are called.
This method will block until all nodes are created, then the VFS::initialized() signal will be emitted, which will trigger other nodes to complete initialization. If a node has the potential to require the VFS to exist (like, for instance a listening server may require auth or other paths to exist), it should listen for the initialized() signal.
If any entries exist in VFS::_monitoredFiles, a monitor timer will be started.
- See also
- VFS_creator::init()
-
VFS_creator::build()
-
VFS_logger
Definition at line 50 of file VFS.cpp.
Destroy the VFS node, which will remove references to logging nodes and return output to cp_init color scheme.
Whenever a VFS_node is deleted, it will delete its children. Calling this will delete all nodes in the VFS, as it is the root.
When a VFS_httpd_browser receives a "/command/exit" request, QCoreApplication::exit(0) is called, which will exit the event loop and call this destructor.
Definition at line 132 of file VFS.cpp.
void VFS::CRITICAL |
( |
QString |
message | ) |
|
|
static |
Send a message to the VFS::_critical VFS_stream.
- Parameters
-
This static global method will create a VFS_request and submit it to "logs/critical".
CRITICAL() messages will appear red in a terminal. An email to VFS::_adminAddress will also be sent, if possible.
This mechanism is for knowable failures, like a disk nearing full, remote credentials failing, credit card payents not completing, excessive access like DOS, etc. This is not for an imminent crash scenario, where little can be done.
Definition at line 357 of file VFS.cpp.
void VFS::monitoredFilesCheck |
( |
| ) |
|
|
private |
Iterate through all monitored files, and check their modification time.
If a file is found to not exist, a warning will be generated. If a file is found to have a modification time later than the one recorded when the server started, the server will exit, and presumably a wrapper script or service monitor will restart it.
This check is performed every 30 seconds.
Definition at line 485 of file VFS.cpp.