Remoto - VFS: VFS_remotoserver_client Class Reference
Remoto - VFS

A subclass of VFS_websocket_client that implements the remoto websocket protocol and handles requests and responses to a connected client. More...

#include <VFS_remotoserver.h>

Inheritance diagram for VFS_remotoserver_client:
VFS_websocket_client VFS_node

Public Slots

virtual void applyDiff (VFS_request *t)
 Apply a diff to this node. More...
 
virtual void receiveResponse (VFS_request *t)
 Receive a response from an issueRequest(). More...
 
virtual void removeSourcePathMap (VFS_node *n)
 Remove a VFS_remotoserver_client::_sourcePathMap entry for a VFS_node. More...
 
- Public Slots inherited from VFS_node
virtual void applyDiff (VFS_request *r)
 Apply a diff received via subscription. More...
 
virtual void executeRequest (VFS_request *t)
 Based on the VFS_request::requestType, execute the function associated with an operation. More...
 
void notifySubscribers (VFS_node *origin, VFS_request *t)
 Propagate a diff to subscribers. More...
 
virtual void receiveResponse (VFS_request *t)
 Once a VFS_request has been completed, a response will be issued back to its _origin. More...
 
void remove (bool andDelete)
 Remove a child node. More...
 
virtual void remove (VFS_node *node=nullptr, QString *name=nullptr, QString user="server")
 Remove a child node from this node. More...
 
virtual void subtreeRequest (VFS_request *t)
 find() the target of a VFS_request, and execute the request More...
 
virtual void unsubscribeAll (VFS_node *n)
 Remove all references to a subscriber from this node. More...
 

Public Member Functions

 VFS_remotoserver_client (QWebSocket *socket, VFS_websocket_server *server)
 
virtual ~VFS_remotoserver_client ()
 
virtual VFS_requestcreateRequest (VFS_request::requestType type, QString path, QString user="unknown", QJsonDocument data=QJsonDocument(), QJsonObject metadata=QJsonObject(), bool dontDelete=false)
 Create a VFS_remotoserver_request to service a request received from a client. More...
 
virtual VFS_nodefind (VFS_request *r)
 VFS_remotoserver_client cannot contain children, but instead points to a websocket client, if connected. More...
 
QJsonObject parameters () const
 Return the parameters provided to this client when authentication was granted. More...
 
virtual QJsonDocument receive (QByteArray data)
 Receive a message from a connected websocket client. More...
 
virtual QString reportDetails ()
 Report the _user and _type of a connected client. More...
 
bool writeError (QString message, bool binary=false)
 Write an error state to a connected client. More...
 
bool writeRequestError (QString command, QString path, QString reason, bool binary=false)
 Write a requesterror command to a connected client. More...
 
bool writeRequestSuccess (QString command, QString path, QJsonDocument data=QJsonDocument(), QJsonObject metadata=QJsonObject(), bool binary=false)
 VFS_remotoserver_client::writeRequestSuccess. More...
 
bool writeUICode (QString libname, QString code, QString error, bool binary=false)
 Write a VFS_request::code response to a connected client. More...
 
bool writeUICodeDirectory (QJsonObject o, QString error, bool binary=false)
 Write a VFS_request::codeDirectory response to a connected client. More...
 
bool writeUIDiff (QString path, QJsonDocument diff, QString user, bool binary=false)
 Send a diff command to a client when something interesting happens on a subscribed VFS_node. More...
 
bool writeUILS (QString id, QString path, QJsonDocument data, QJsonObject metadata, bool binary=false)
 Write a VFS_request::ls response to a connected client. More...
 
bool writeUIMetadata (QString path, QJsonObject metadata, bool binary=false)
 Write a VFS_request::metadata response to a connected client. More...
 
bool writeUIRead (QString path, QJsonDocument data, QJsonObject metadata, bool binary=false)
 Send the results of a VFS_request::read command to a client. More...
 
bool writeUIReleaseLock (QString path, QJsonDocument data, bool binary=false)
 Write the results of a VFS_request::releaselock to a connected client. More...
 
bool writeUIRequestLock (QString path, QJsonDocument data, bool binary=false)
 Write the results of a VFS_request::requestlock to a connected client. More...
 
bool writeUIRM (QString path, bool binary=false)
 Send an RM command to a connected client. More...
 
bool writeUISubscribe (QString path, QJsonDocument data, QJsonObject metadata, bool binary=false)
 Write a VFS_request::subscribe response to a connected client. More...
 
bool writeUIWrite (QString path, QJsonDocument data, QJsonObject metadata, bool binary=false)
 Write data to a connected client. More...
 
- Public Member Functions inherited from VFS_websocket_client
 VFS_websocket_client (QString wsurl, quint16 interval=3000)
 
 VFS_websocket_client (QWebSocket *socket, VFS_websocket_server *server)
 
virtual ~VFS_websocket_client ()
 VFS_websocket_client destructor -. More...
 
virtual bool isConnected ()
 If the client will attempt to reconnect, return true. More...
 
virtual bool isConnecting ()
 If the client will attempt to reconnect, return true. More...
 
virtual bool isContainer ()
 A VFS_websocket_client cannot contain children. More...
 
virtual void submit (VFS_request *r)
 Submit to the socket. More...
 
virtual bool writeBinary (QByteArray data)
 Write binary data over the websocket. More...
 
virtual bool writeText (QString data)
 Write text data over the websocket. More...
 
- Public Member Functions inherited from VFS_node
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_nodeappend (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...
 
VFS_nodefind (QString path)
 Find a node by string path. More...
 
VFS_nodefindChildWithName (QString name)
 Check if a child with a given name exists. More...
 
virtual VFS_nodemount ()
 Mount this node. More...
 
QString uniqueChildName (QString name)
 Generate a unique child name. More...
 
virtual VFS_nodeunmount ()
 Unmount this node. More...
 
virtual bool validChildName (QString name)
 Check if a node name is valid. More...
 

Protected Member Functions

void addSourcePathMap (VFS_node *source, QString path)
 Add a VFS_remotoserver_client::_sourcePathMap entry for a path from a client's perspective to a VFS_node. More...
 
virtual void authenticate (QJsonDocument d)
 Authenticate a user using VFS_websocket_server::authenticate(). More...
 
virtual void rm (VFS_request *r)
 Send an RM command to a user. More...
 
virtual void write (VFS_request *r)
 Write form or interface information back to a user. More...
 
- Protected Member Functions inherited from VFS_websocket_client
virtual void authorized ()
 Notify the node that it has received authorization from some auth method. More...
 
virtual void init ()
 Initialize needed signal/slot connections. More...
 
- Protected Member Functions inherited from VFS_node
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 QByteArray icon ()
 Fetch the icon for a node. 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 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...
 

Protected Attributes

QJsonObject _parameters
 Parameters provided during the auth process. More...
 
VFS_session_session
 The session associated with this client connection. More...
 
QMap< VFS_node *, QString > _sourcePathMap
 A map relating path requests from a client to path requests on the VFS. More...
 
QString _type
 The remote client type, which may be "browser" or "unity" or any other id string. More...
 
QString _user
 The authenticated client's username. More...
 
- Protected Attributes inherited from VFS_websocket_client
QHostAddress _address
 The network address of the connected client. More...
 
bool _authenticated
 if auth has taken place and succeeded More...
 
bool _authorized
 if this connection has a session More...
 
int _connectID
 For client connections, the reconnect timerID. More...
 
quint16 _interval
 The reconnect interval if disconnected. More...
 
bool _isClient
 A client connection may not be created by a listening server, thus the second constructor. More...
 
int _pingID
 Connections can become stale; This is the ID of the ping timer. More...
 
VFS_websocket_server_server
 owning server More...
 
QWebSocket * _socket
 client socket More...
 
QString _wsurl
 For client connections, the WebSocket address to connect to. More...
 
- Protected Attributes inherited from VFS_node
VFS_children _children
 This node's children. More...
 
QMutex _lock
 A recursive mutex that is local to this node. More...
 
VFS_subscriptionType _subscribers
 This node's subscribers. These subscribers will receive diff notifications. More...
 

Friends

class VFS_remotoserver_request
 

Additional Inherited Members

- Signals inherited from VFS_websocket_client
void connected ()
 Connection has been made. More...
 
void disconnected ()
 Connection has been lost. More...
 
void error (QAbstractSocket::SocketError)
 There has been a socket error. More...
 
void readyBinaryMessage (QByteArray message)
 A binary message has been received. More...
 
void readyTextMessage (QString message)
 A text message has been received. More...
 
- Signals inherited from VFS_node
void diff (VFS_node *origin, VFS_request *t)
 Emit a diff, which will trigger notifySubscribers() for a mounted node. More...
 
void finished (bool andDelete=false)
 Emitted if a thread fails to create its node, or a node is rm()'d, or any other reason a node has completed its lifecycle. It is deleted if andDelete==true. More...
 
void mounted ()
 Emitted when a node is mount()ed. More...
 
void unmounted (VFS_node *self)
 Emitted when a node is unmount()ed. More...
 
- Static Public Member Functions inherited from VFS_node
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...
 
- Protected Slots inherited from VFS_websocket_client
virtual void close ()
 Close the socket if it is connected. More...
 
virtual void socket_connected ()
 Slot called when the client is connected. More...
 
virtual void socket_disconnected ()
 Slot called when the client is disconnected. More...
 
virtual void socket_receive_binary (QByteArray message)
 VFS_websocket_client::socket_receive_binary. More...
 
virtual void socket_receive_text (QString message)
 The socket has received a message in text mode. More...
 
virtual void startPing ()
 Start the ping timer. More...
 
virtual void timerEvent (QTimerEvent *event)
 Send the ping command. More...
 

Detailed Description

A subclass of VFS_websocket_client that implements the remoto websocket protocol and handles requests and responses to a connected client.

This node will do the heavy lifting work of parsing incoming messages, sending requests to other VFS_node paths on the VFS, and routing responses back to the end user. All websocket clients must be authenticated, which is automatically done with VFS_websocket_server::authenticate().

The connected client will usually be a web browser, but could also be a unity game engine, for instance, or another VFS.

See also
VFS_websocket_client

Definition at line 33 of file VFS_remotoserver.h.

Constructor & Destructor Documentation

◆ VFS_remotoserver_client()

VFS_remotoserver_client::VFS_remotoserver_client ( QWebSocket *  socket,
VFS_websocket_server server 
)
explicit
Parameters
socketA newly created QWebSocket provided by the server
serverThe server instance that created the socket
See also
VFS_websocket_client::VFS_websocket_client(QWebSocket *socket, VFS_websocket_server *server)

Definition at line 150 of file VFS_remotoserver.cpp.

◆ ~VFS_remotoserver_client()

VFS_remotoserver_client::~VFS_remotoserver_client ( )
virtual

Definition at line 157 of file VFS_remotoserver.cpp.

Member Function Documentation

◆ addSourcePathMap()

void VFS_remotoserver_client::addSourcePathMap ( VFS_node source,
QString  path 
)
protected

Add a VFS_remotoserver_client::_sourcePathMap entry for a path from a client's perspective to a VFS_node.

Parameters
sourceThe node that responded to a VFS_request::subscribe request
pathThe path to map

Because a VFS_node doesn't know what its path is, the client must take note of the path used to subscribe to a node, and use that mapping to formulate a response to a request.

This map is maintained by connecting to the unmounted() signal of the VFS_node.

See also
VFS_remotoserver_request::execute()

Definition at line 950 of file VFS_remotoserver.cpp.

◆ applyDiff

void VFS_remotoserver_client::applyDiff ( VFS_request t)
virtualslot

Apply a diff to this node.

Parameters
tThe VFS_request object

A diff occurs when a client subscribes to a VFS_node and a diff is emitted from it. Most frequently, a diff originates from a submit() operation, but could also come from a timer event or potentially any other thing a node wants to do.

The path will always be cleaned using rutils::cleanPath() first.

If a mapping in _sourcePathMap does not exist, the applyDiff() will fail. Otherwise it will succeed.

Definition at line 196 of file VFS_remotoserver.cpp.

◆ authenticate()

void VFS_remotoserver_client::authenticate ( QJsonDocument  d)
protectedvirtual

Authenticate a user using VFS_websocket_server::authenticate().

Parameters
dThe remoto command received.

This method is called when VFS_websocket_client::_authenticated==false. If the "command" field of the command is not "identify", the client will be dropped after sending a failed authorization response.

See also
vfsClient

Definition at line 718 of file VFS_remotoserver.cpp.

◆ createRequest()

VFS_request * VFS_remotoserver_client::createRequest ( VFS_request::requestType  type,
QString  path,
QString  user = "unknown",
QJsonDocument  data = QJsonDocument(),
QJsonObject  metadata = QJsonObject(),
bool  dontDelete = false 
)
virtual

Create a VFS_remotoserver_request to service a request received from a client.

Parameters
typeThe request type
pathThe request path
userThe user who is performing the request
dataThe request data
metadataThe request metadata
dontDeleteAn unused parameter which is present only for polymorphism
Returns
The new request, with this set as the _origin.

Reimplemented from VFS_node.

Definition at line 173 of file VFS_remotoserver.cpp.

◆ find()

VFS_node * VFS_remotoserver_client::find ( VFS_request r)
virtual

VFS_remotoserver_client cannot contain children, but instead points to a websocket client, if connected.

Parameters
rThe VFS_request object
Returns
this

this is always returned. This only comes into play when a client is being written to... let the path fragment flow to the client.

See also
VFS_remotoserver_client::write()

Reimplemented from VFS_node.

Definition at line 756 of file VFS_remotoserver.cpp.

◆ parameters()

QJsonObject VFS_remotoserver_client::parameters ( ) const

Return the parameters provided to this client when authentication was granted.

Returns
The const _parameters value

Definition at line 1478 of file VFS_remotoserver.cpp.

◆ receive()

QJsonDocument VFS_remotoserver_client::receive ( QByteArray  data)
virtual

Receive a message from a connected websocket client.

Parameters
dataThe message

This is the meat of the protocol handler. First, the incoming message is parsed as JSON. If a non-parseable command is received, the socket is closed and the client is dropped. An error is logged.

Commands must follow the form:

{
"command":"[command]",
"attributes":"[various, probably an object. Refer to the table below]"
}

The first command received from a client must be an "identify" command, or the connection will be dropped.

The following incoming commands are recognized:

Command Action Notify Exception Object Value
identify call VFS_remotoserver_client::authenticate() No No credentials
ping keep the connection alive. Send:
{ "command":"pong" }
No No
create send a VFS_request::create request on a path. No Yes
rm send a VFS_request::rm request on a path No Yes boolean true
subscribe send a VFS_request::subscribe on a path No Yes subscription count
read send a VFS_request::read on a path No Yes
submit send a VFS_request::submit on a path Yes Yes data
write send a VFS_request::write on a path Yes Yes data
unsubscribe send a VFS_request::unsubscribe on a path No Yes boolean true
ls send a VFS_request::ls on a path No Yes
{ "path":"some/path", "metadata":{} }
metadata send a VFS_request::metadata on a path No Yes
requestlock send a VFS_request::requestlock on a path No Yes key to lock on
releaselock send a VFS_request::releaselock on a path No Yes key to release
code call VFS_creator::code() with the library:nodename No Yes boolean true
codeDirectory call VFS_creator::codeDirectory() No No
Todo:
Modify the submit/write submit syntax to include metadata, like ls()

Some commands receive an object syntax, which is a way of batching requests. Some require require a boolean true to be set, others just use the object as a list.

//for an rm command
{
"/some/path": true,
"/some/other/path": true
}
//for a submit command
{
"/applications/favorite/path": { "alpha": "beta",
"gamma": 10003
},
"/services/cron": { "newyear": "0 0 0 1 1 * * -5"
}
}
See also
vfsClient

Reimplemented from VFS_websocket_client.

Definition at line 289 of file VFS_remotoserver.cpp.

◆ receiveResponse

void VFS_remotoserver_client::receiveResponse ( VFS_request t)
virtualslot

Receive a response from an issueRequest().

Parameters
tThe VFS_request object

If a client has _authenticated==false, check the _success of the request, and populate an "authorization" command response with user information.

If the client has already been authenticated, call VFS_node::receiveResponse().

See also
Requests
VFS_node::receiveResponse()
VFS_sessionManager
VFS_session::read()

Definition at line 835 of file VFS_remotoserver.cpp.

◆ removeSourcePathMap

void VFS_remotoserver_client::removeSourcePathMap ( VFS_node s)
virtualslot

Remove a VFS_remotoserver_client::_sourcePathMap entry for a VFS_node.

Parameters
sThe VFS_node

This happens when the target VFS_node is unmounted().

Definition at line 974 of file VFS_remotoserver.cpp.

◆ reportDetails()

QString VFS_remotoserver_client::reportDetails ( )
virtual

Report the _user and _type of a connected client.

Returns
A string containing the additional details.

Reimplemented from VFS_node.

Definition at line 768 of file VFS_remotoserver.cpp.

◆ rm()

void VFS_remotoserver_client::rm ( VFS_request r)
protectedvirtual

Send an RM command to a user.

Parameters
rThe VFS_request object

This happens when a node wants to write an rm directly to a client, probably from an event that was not initiated by the user.

For instance, the receiving side may also have a VFS or quasi-VFS that needs to execute an RM.

Calls writeUIRM() using the VFS_request object, and always sets r->_success=true.

See also
vfsClient

Reimplemented from VFS_node.

Definition at line 813 of file VFS_remotoserver.cpp.

◆ write()

void VFS_remotoserver_client::write ( VFS_request r)
protectedvirtual

Write form or interface information back to a user.

Parameters
rThe VFS_request object

This happens when a node wants to write directly to a client, probably from an event that was not initiated by the user.

For instance, we may want to open a modal in the user's interface, or tell a client that it needs to reload.

Calls writeUIWrite() using the VFS_request object, and always sets r->_success=true.

See also
vfsClient

Reimplemented from VFS_websocket_client.

Definition at line 790 of file VFS_remotoserver.cpp.

◆ writeError()

bool VFS_remotoserver_client::writeError ( QString  message,
bool  binary = false 
)

Write an error state to a connected client.

Parameters
messageThe error message
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()

Some operations may generate an error. This method will trigger an error modal on the client.

Definition at line 1396 of file VFS_remotoserver.cpp.

◆ writeRequestError()

bool VFS_remotoserver_client::writeRequestError ( QString  command,
QString  path,
QString  reason,
bool  binary = false 
)

Write a requesterror command to a connected client.

Parameters
commandThe request command that has failed
pathThe request path that has failed
reasonThe reason for failure, if possible to know
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()

Some operations may generate an error. This method will send a requesterror command to the client, which will give it an opportunity to deal with the problem, if possible.

Definition at line 1424 of file VFS_remotoserver.cpp.

◆ writeRequestSuccess()

bool VFS_remotoserver_client::writeRequestSuccess ( QString  command,
QString  path,
QJsonDocument  data = QJsonDocument(),
QJsonObject  metadata = QJsonObject(),
bool  binary = false 
)

VFS_remotoserver_client::writeRequestSuccess.

Parameters
commandThe request command that has succeeded.
pathThe request path that has succeeded.
dataThe data to send back, which may be empty.
metadataThe metadata to send back, which may be empty.
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()

Some operations submitted by the client and not asking for a response. For instance, VFS_request::submit and VFS_request::create. However, we want to notify the client of success so it has an opportunity to trigger callbacks.

Definition at line 1454 of file VFS_remotoserver.cpp.

◆ writeUICode()

bool VFS_remotoserver_client::writeUICode ( QString  name,
QString  code,
QString  error,
bool  binary = false 
)

Write a VFS_request::code response to a connected client.

Parameters
nameThe nodename:libname of the request
codeThe code or raw data to return
errorAn error string, if it is set
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()
See also
VFS_creator::code()
VFS_websocket_client::writeBinary()
VFS_websocket_client::writeText()
vfsClient

Definition at line 1332 of file VFS_remotoserver.cpp.

◆ writeUICodeDirectory()

bool VFS_remotoserver_client::writeUICodeDirectory ( QJsonObject  o,
QString  error,
bool  binary = false 
)

Write a VFS_request::codeDirectory response to a connected client.

Parameters
oThe code directory to send
errorAn error to write back to the client
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()
See also
VFS_creator::codeDirectory()

Definition at line 1365 of file VFS_remotoserver.cpp.

◆ writeUIDiff()

bool VFS_remotoserver_client::writeUIDiff ( QString  path,
QJsonDocument  diff,
QString  user,
bool  binary = false 
)

Send a diff command to a client when something interesting happens on a subscribed VFS_node.

Parameters
pathThe path to report to the client
diffThe diff
userThe user originating the diff
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()
See also
VFS_node::applyDiff()
VFS_websocket_client::writeBinary()
VFS_websocket_client::writeText()
vfsClient

Definition at line 1004 of file VFS_remotoserver.cpp.

◆ writeUILS()

bool VFS_remotoserver_client::writeUILS ( QString  id,
QString  path,
QJsonDocument  data,
QJsonObject  metadata,
bool  binary = false 
)

Write a VFS_request::ls response to a connected client.

Parameters
idThe ls id of the request.
pathThe path to write to the client
dataThe ls data
metadataThe ls metadata
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()

Because ls requests can be asynchronous and the requests need to be tracked by the client (for modals), an id is assigned.

See also
VFS_node::ls()
VFS_websocket_client::writeBinary()
VFS_websocket_client::writeText()
vfsClient

Definition at line 1195 of file VFS_remotoserver.cpp.

◆ writeUIMetadata()

bool VFS_remotoserver_client::writeUIMetadata ( QString  path,
QJsonObject  metadata,
bool  binary = false 
)

Write a VFS_request::metadata response to a connected client.

Parameters
pathThe path to write to the client
metadataThe metadata
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()
See also
VFS_node::metadata()
VFS_websocket_client::writeBinary()
VFS_websocket_client::writeText()
vfsClient

Definition at line 1229 of file VFS_remotoserver.cpp.

◆ writeUIRead()

bool VFS_remotoserver_client::writeUIRead ( QString  path,
QJsonDocument  data,
QJsonObject  metadata,
bool  binary = false 
)

Send the results of a VFS_request::read command to a client.

Parameters
pathThe path to report to the client
dataThe read data
metadataThe read metadata
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()
See also
VFS_node::read()
VFS_websocket_client::writeBinary()
VFS_websocket_client::writeText()
vfsClient

Definition at line 1045 of file VFS_remotoserver.cpp.

◆ writeUIReleaseLock()

bool VFS_remotoserver_client::writeUIReleaseLock ( QString  path,
QJsonDocument  data,
bool  binary = false 
)

Write the results of a VFS_request::releaselock to a connected client.

Parameters
pathThe path to write to the client
dataThe boolean status of eash requested key
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()

Keys can always be released. The status of each released key will be true, and written back to the client:

{
"key1": true,
"key2": true
}

Definition at line 1299 of file VFS_remotoserver.cpp.

◆ writeUIRequestLock()

bool VFS_remotoserver_client::writeUIRequestLock ( QString  path,
QJsonDocument  data,
bool  binary = false 
)

Write the results of a VFS_request::requestlock to a connected client.

Parameters
pathThe path to write to the client
dataThe boolean status of eash requested key
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()

The status of each requested key will be written back to the client:

{
"key1": true,
"key2": false
}

Definition at line 1265 of file VFS_remotoserver.cpp.

◆ writeUIRM()

bool VFS_remotoserver_client::writeUIRM ( QString  path,
bool  binary = false 
)

Send an RM command to a connected client.

Parameters
pathThe path to rm on the client
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()
See also
VFS_node::rm()
VFS_remotoserver_client::rm()
VFS_websocket_client::writeBinary()
VFS_websocket_client::writeText()
vfsClient

Definition at line 1121 of file VFS_remotoserver.cpp.

◆ writeUISubscribe()

bool VFS_remotoserver_client::writeUISubscribe ( QString  path,
QJsonDocument  data,
QJsonObject  metadata,
bool  binary = false 
)

Write a VFS_request::subscribe response to a connected client.

Parameters
pathThe path to write to the client
dataThe subscribe data
metadataThe subscribe metadata
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()
See also
VFS_node::subscribe()
VFS_websocket_client::writeBinary()
VFS_websocket_client::writeText()
vfsClient

Definition at line 1152 of file VFS_remotoserver.cpp.

◆ writeUIWrite()

bool VFS_remotoserver_client::writeUIWrite ( QString  path,
QJsonDocument  data,
QJsonObject  metadata,
bool  binary = false 
)

Write data to a connected client.

This will probably be a modal form.

Parameters
pathThe path to write to the client
dataThe write data
metadataThe write metadata
binarySend using binary?
Returns
success or fail of writeBinary() / writeText()
See also
VFS_node::write()
VFS_remotoserver_client::write()
VFS_websocket_client::writeBinary()
VFS_websocket_client::writeText()
vfsClient

Definition at line 1084 of file VFS_remotoserver.cpp.

Friends And Related Function Documentation

◆ VFS_remotoserver_request

friend class VFS_remotoserver_request
friend

Definition at line 37 of file VFS_remotoserver.h.

Member Data Documentation

◆ _parameters

QJsonObject VFS_remotoserver_client::_parameters
protected

Parameters provided during the auth process.

Todo:
This is a weak implementation, as it requires casting pointers. Create a more comprehensive solution here.

Definition at line 84 of file VFS_remotoserver.h.

◆ _session

VFS_session* VFS_remotoserver_client::_session
protected

The session associated with this client connection.

Definition at line 78 of file VFS_remotoserver.h.

◆ _sourcePathMap

QMap<VFS_node *, QString> VFS_remotoserver_client::_sourcePathMap
protected

A map relating path requests from a client to path requests on the VFS.

We need to match VFS_request::_path with a response path, as the requesting client requests on a different path than the response may indicate.

Todo:
This should be fixed and removed, because VFS_request::_initialPath is now available, which should do the trick

Definition at line 85 of file VFS_remotoserver.h.

◆ _type

QString VFS_remotoserver_client::_type
protected

The remote client type, which may be "browser" or "unity" or any other id string.

This will be used in the future when/if there are many client types that need different treatment and initialization upon authentication.

Definition at line 83 of file VFS_remotoserver.h.

◆ _user

QString VFS_remotoserver_client::_user
protected

The authenticated client's username.

Definition at line 82 of file VFS_remotoserver.h.


The documentation for this class was generated from the following files: