Remoto - VFS: VFS_tcp_export_request Class Reference
Remoto - VFS

The VFS_tcp_export class needs path information to translate between mounted VFS instances. More...

#include <VFS_tcp_export_client.h>

Inheritance diagram for VFS_tcp_export_request:
VFS_request

Public Member Functions

 VFS_tcp_export_request (VFS_tcp_client *origin, QString exportRoot)
 
virtual ~VFS_tcp_export_request ()
 
virtual VFS_requestcreateDiff (VFS_node *origin, QString originPath)
 VFS_tcp_export_request::createDiff. More...
 
virtual void fromJsonObject (QJsonObject json, bool includeInitialPath=false)
 Deserialize a JSON string into a VFS_request. More...
 
virtual QByteArray toJson (postID id=0, bool ignoreSuccess=false, bool includeInitialPath=false)
 Serialize this request. 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_requestgetCallback (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...
 

Static Public Member Functions

static VFS_tcp_export_requestfromMessage (QByteArray message, QString exportRoot, VFS_tcp_client *origin)
 
- Static Public Member Functions inherited from VFS_request
static quint32 getSample ()
 Get the current sample count and clear the counter. More...
 

Protected Member Functions

virtual void execute ()
 DOCME. More...
 

Protected Attributes

QString _exportRoot
 The VFS node being exported. More...
 
postID _id
 The ID of this request. More...
 
bool _pendingSession
 This request is pending a session definition. More...
 

Friends

class VFS_tcp_export_client
 
class VFS_tcp_export_sessionManager
 

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...
 
- 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...
 
- 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...
 

Detailed Description

The VFS_tcp_export class needs path information to translate between mounted VFS instances.

This subclass of VFS_request provides that.

Definition at line 54 of file VFS_tcp_export_client.h.

Constructor & Destructor Documentation

◆ VFS_tcp_export_request()

VFS_tcp_export_request::VFS_tcp_export_request ( VFS_tcp_client origin,
QString  exportRoot 
)
Parameters
originThe origin of the VFS_request.
exportRootThe root of the export, which will be used in translation between VFS instances.

Definition at line 537 of file VFS_tcp_export_client.cpp.

◆ ~VFS_tcp_export_request()

VFS_tcp_export_request::~VFS_tcp_export_request ( )
virtual

Definition at line 545 of file VFS_tcp_export_client.cpp.

Member Function Documentation

◆ createDiff()

VFS_request * VFS_tcp_export_request::createDiff ( VFS_node origin,
QString  originPath 
)
virtual

VFS_tcp_export_request::createDiff.

Parameters
originThe origin request of the diff
originPathThe originPath, which is from the subscribers list
Returns
A new VFS_tcp_export_request::diff node, which can be distributed to subscribers.
See also
VFS_request::createDiff()

Reimplemented from VFS_request.

Definition at line 684 of file VFS_tcp_export_client.cpp.

◆ execute()

void VFS_tcp_export_request::execute ( )
protectedvirtual

DOCME.

Reimplemented from VFS_request.

Definition at line 712 of file VFS_tcp_export_client.cpp.

◆ fromJsonObject()

void VFS_tcp_export_request::fromJsonObject ( QJsonObject  json,
bool  includeInitialPath = false 
)
virtual

Deserialize a JSON string into a VFS_request.

Parameters
jsonThe serialized data
includeInitialPathOverride for initial path, which is usually unneeded.

The _path field is prefixed with the _exportRoot

See also
VFS_request::fromJsonObject()

Reimplemented from VFS_request.

Definition at line 559 of file VFS_tcp_export_client.cpp.

◆ fromMessage()

VFS_tcp_export_request * VFS_tcp_export_request::fromMessage ( QByteArray  message,
QString  exportRoot,
VFS_tcp_client origin 
)
static
Parameters
messageThe incoming messag to decode.
exportRootThe exportRoot for this request.
originThe VFS_request origin
Returns
A new VFS_tcp_export_request, or nullptr if it could not be decoded from JSON

Definition at line 604 of file VFS_tcp_export_client.cpp.

◆ toJson()

QByteArray VFS_tcp_export_request::toJson ( postID  id = 0,
bool  ignoreSuccess = false,
bool  includeInitialPath = false 
)
virtual

Serialize this request.

Parameters
idA request id, used to match requests coming back from a network request
ignoreSuccessUsually we only want _data if there is _success. Override that here.
includeInitialPathThe initial path is usually useless on a receiving side, as that context doesn't match this context.
Returns
The JSON-serialized VFS_request

The _path field has the _exportRoot removed from the beginning.

See also
VFS_request::toJson()

Reimplemented from VFS_request.

Definition at line 630 of file VFS_tcp_export_client.cpp.

Friends And Related Function Documentation

◆ VFS_tcp_export_client

friend class VFS_tcp_export_client
friend

Definition at line 56 of file VFS_tcp_export_client.h.

◆ VFS_tcp_export_sessionManager

friend class VFS_tcp_export_sessionManager
friend

Definition at line 57 of file VFS_tcp_export_client.h.

Member Data Documentation

◆ _exportRoot

QString VFS_tcp_export_request::_exportRoot
protected

The VFS node being exported.

Definition at line 73 of file VFS_tcp_export_client.h.

◆ _id

postID VFS_tcp_export_request::_id
protected

The ID of this request.

Definition at line 72 of file VFS_tcp_export_client.h.

◆ _pendingSession

bool VFS_tcp_export_request::_pendingSession
protected

This request is pending a session definition.

Definition at line 75 of file VFS_tcp_export_client.h.


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