Remoto - VFS
|
A subclass of VFS_request used for websocket (VFS_remotoserver) communication. More...
#include <VFS_remotoserver.h>
Public Member Functions | |
VFS_remotoserver_request (VFS_request::requestType type, VFS_remotoserver_client *origin, QString path="", QString user="unknown", QJsonDocument data=QJsonDocument(), QJsonObject metadata=QJsonObject(), bool binary=false) | |
virtual | ~VFS_remotoserver_request () |
virtual void | execute () |
Dynamically cast the _origin node to a VFS_remotoserver_client and write the results of a request to it. More... | |
Public Member Functions inherited from VFS_request | |
VFS_request (const VFS_request &c) | |
Copy constructor. More... | |
VFS_request (requestType type=VFS_request::none, VFS_node *origin=nullptr, QString path="", QString user="unknown", QJsonDocument data=QJsonDocument(), QJsonObject metadata=QJsonObject(), bool dontDelete=false) | |
VFS_request constructor. More... | |
virtual | ~VFS_request () |
VFS_request destructor. More... | |
virtual void | copyCallback (VFS_request *d) |
Copy the data from a callback to this VFS_request. More... | |
virtual VFS_request * | createDiff (VFS_node *origin, QString originPath) |
VFS_request::createDiff. More... | |
virtual void | fromJsonObject (QJsonObject json, bool includeInitialPath=false) |
Deserialize a JSON string into a VFS_request. More... | |
virtual VFS_request * | getCallback (VFS_node *receiver) |
Create and chain a VFS_request for a receiver. More... | |
bool | hasCallback () |
Check if this request has a callback set. More... | |
virtual void | setCallback (VFS_request *c) |
Chain a callback onto this request. More... | |
virtual void | timerEvent (QTimerEvent *e=nullptr) |
The callback for when a request times out. More... | |
virtual QByteArray | toJson (postID id=0, bool ignoreSuccess=false, bool includeInitialPath=false) |
Serialize this request. More... | |
Public Attributes | |
bool | _binary |
Binary mode flag for websocket messages. More... | |
Public Attributes inherited from VFS_request | |
VFS_request * | _callback |
request to execute once this request completes More... | |
QJsonDocument | _data |
the request payload More... | |
bool | _dontDelete |
A rarely used flag that will cause VFS_node::receiveResponse to not delete the node, which forces the developer to manually delete it when appropriate. More... | |
QString | _initialPath |
the target path when the request was made (relative to the responder) More... | |
bool | _isCallback |
whether or not to issue a response (IE, another request is chained to this request, whose response will trigger this one to respond) More... | |
QJsonObject | _metadata |
the request payload More... | |
QList< notifyException > | _notifyExceptions |
a list of nodes not to send responses to for this transaction. For instance if a node submits to a node it is subscribed to, it doesn't expect to get the submit data back to itself. More... | |
VFS_node * | _origin |
the origin of the request More... | |
QString | _originPath |
the subpath of the origin node More... | |
QString | _path |
the target path remnant... the remaining path element once the request has found its target More... | |
QStringList | _prefixPath |
the prefix elements found while searching for the target More... | |
QByteArray | _rawData |
the request payload, but raw data More... | |
QString | _reason |
if something (probably bad) happened, this is the reason More... | |
requestType | _requestType |
the action this request is performing or requesting More... | |
VFS_node * | _responder |
the receiver of the request More... | |
VFS_session * | _session |
The session associated with this request. This is an optional value, and care should be taken to check for null as needed. More... | |
bool | _success |
if the request was successfully completed More... | |
QString | _user |
who initiated this request, mostly for logging More... | |
Additional Inherited Members | |
Public Types inherited from VFS_request | |
enum | requestType { none = 0 , ls , create , rm , read , write , metadata , diff , submit , subscribe , unsubscribe , acl , report , requestlock , releaselock , code , codeDirectory } |
Requests perform one of these actions. More... | |
Static Public Member Functions inherited from VFS_request | |
static quint32 | getSample () |
Get the current sample count and clear the counter. More... | |
Static Public Attributes inherited from VFS_request | |
static long | _refcount = 0 |
A reference counter for VFS_request instances, used for debugging to ensure all instances are properly deleted. More... | |
static quint32 | _sampleCount = 0 |
A count of the number of VFS_requests since the last sample was taken. More... | |
static QMutex | _sampleLock |
A mutex to protect thread safety of samples. More... | |
static const char * | requestTypeStrings [] |
A printable string for each request type. More... | |
A subclass of VFS_request used for websocket (VFS_remotoserver) communication.
This class receives a VFS_remotoserver_client as its _origin, and will write back to that client when execute() is called.
If the _binary flag is set, websocket communication will be in binary mode.
Definition at line 95 of file VFS_remotoserver.h.
VFS_remotoserver_request::VFS_remotoserver_request | ( | VFS_request::requestType | type, |
VFS_remotoserver_client * | origin, | ||
QString | path = "" , |
||
QString | user = "unknown" , |
||
QJsonDocument | data = QJsonDocument() , |
||
QJsonObject | metadata = QJsonObject() , |
||
bool | binary = false |
||
) |
type | The VFS_request type |
origin | The VFS_remotoserver_client creating the request |
path | VFS path for request |
user | User associated with the request |
data | Payload data |
metadata | Payload metadata |
binary | Binary flag for websocket messages |
Definition at line 1502 of file VFS_remotoserver.cpp.
|
virtual |
Definition at line 1508 of file VFS_remotoserver.cpp.
|
virtual |
Dynamically cast the _origin node to a VFS_remotoserver_client and write the results of a request to it.
If the cast fails, or the node is deemed to no longer exist, the execute will fail.
execute() will switch based on _success and _requestType, and determine what to write back to the client.
It will update the client's _sourcePathMap for subcribe() operations, which is the mechanism used to translate paths back for websocket clients.
Reimplemented from VFS_request.
Definition at line 1524 of file VFS_remotoserver.cpp.
bool VFS_remotoserver_request::_binary |
Binary mode flag for websocket messages.
Definition at line 103 of file VFS_remotoserver.h.