Remoto - VFS: VFS_stdlib Class Reference
Remoto - VFS
VFS_stdlib Class Reference

The standard library of nodes needed to build a VFS. More...

#include <VFS_stdlib.h>

Inheritance diagram for VFS_stdlib:
VFS_node_interface

Public Member Functions

virtual QString arguments (QString type)
 Return an argument string for each stdlib node's constructor. More...
 
virtual QString code (QString nodename, QString libname, QString &error)
 Return code for namespace stdlib. More...
 
virtual VFS_nodecreate (QString type, QVariantMap env, QDomElement child)
 Create a new node instance. More...
 
virtual QString description (QString type)
 Descriptive text about an individual node. More...
 
virtual bool initialize ()
 Register the browser and vfsclient types. More...
 
virtual bool licensed (QString type)
 Check remoto licensing. More...
 
virtual QStringList provides ()
 A string list of node names that this plugin is prepared to create. More...
 
- Public Member Functions inherited from VFS_node_interface
virtual ~VFS_node_interface ()
 
QString describe ()
 Describe all the nodes in a plugin. More...
 
bool isRemote ()
 If a plugin represents a remote resource, this value will be true. More...
 
VFS_noderemoteNode ()
 Return the node needed to satisfy a remote request. More...
 

Additional Inherited Members

- Protected Member Functions inherited from VFS_node_interface
 VFS_node_interface (VFS_node *remoteNode=nullptr)
 VFS_node_interface::VFS_node_interface. More...
 
QString argumentString (QMetaObject s)
 Format a constructor string based on a node's metadata object. More...
 
- Protected Attributes inherited from VFS_node_interface
bool _remote
 Does this plugin exist on another resource? More...
 
VFS_node_remoteNode
 The node responding to requests for remote resources. More...
 

Detailed Description

The standard library of nodes needed to build a VFS.

Any basic VFS can be created using the nodes found here. This includes networking, file storage, authentication, timers, etc. In addition, it can serve the default javascript GUI which has a paneManager, logging panes, widgets for forms, menus, etc.

Included Nodes:

Config file tag Node Class Brief
node VFS_node VFS_node is the base class from which all other VFS_node classes derive.  
aclnode VFS_aclnode A subclass of VFS_application for having a generic VFS_node with ACL support.  
hd VFS_HD A VFS_datastore subclass for storing data on a locally attached hard drive or NFS share.  
qrc VFS_QRC Qt resource data node.  
ephemeral VFS_ephemeral A VFS_datastore subclass for storing data directly in memory as if it was a filesystem.  
applications VFS_applications This is an empty wrapper that will elevate a node to VFS_application status, which will use ACLs for permissions.  
cron VFS_cron VFS_cron will emit diffs to subscribers based on wall-clock time.  
curl VFS_curl VFS_curl reads data from a url when read() is called.  
stream VFS_stream VFS_stream stores data sequentially within a buffer.  
pulse VFS_pulse VFS_pulse provides an event pulse that can be subscribed to.  
ifrrame VFS_iframe VFS_iframe is a button for opening an iframe in a panel.  
sessions VFS_sessionManager VFS_sessionManager manages connected clients and their session data.  
acl VFS_acl The ACL class for maintaining permission to nodes.  
nopasswd VFS_nopasswd The VFS_nopasswd authenticator uses a nopasswd file to store username, uidnumber, a real name, and group membership.  
passwd VFS_passwd The VFS_passwd authenticator uses a passwd file to store username, hashed password, uidnumber, a real name, and group membership.  
curlauth VFS_curlauth The VFS_curlauth authenticator performs a POST request to a url for authentication.  
tcp_export VFS_tcp_export Open a listening TCP socket for mounting one VFS into another.  
tcp_mount VFS_tcp_mount The VFS_tcp_mount class is a client side connection that will attempt to connect to another VFS instance.  
udp_socket VFS_udp_socket Open a UDP port in write or read/write mode.  
httpd_browser VFS_httpd_browser A subclass of VFS_httpd which will display a summary of the current state of the VFS.  
remotoserver VFS_remotoserver VFS_remotoserver is a subclass of VFS_websocket_server.  
See also
XML Config File(s)

Definition at line 6 of file VFS_stdlib.h.

Member Function Documentation

◆ arguments()

QString VFS_stdlib::arguments ( QString  type)
virtual

Return an argument string for each stdlib node's constructor.

Parameters
typeThe type being queried
Returns
A formatted argument string

Reimplemented from VFS_node_interface.

Definition at line 186 of file VFS_stdlib.cpp.

◆ code()

QString VFS_stdlib::code ( QString  nodename,
QString  libname,
QString &  error 
)
virtual

Return code for namespace stdlib.

Parameters
nodenameThe nodename of the plugin to query for code.
libnameThe libname to fetch.
errorAn error string to write back to if there's a problem.
Returns
The raw source code or resource requested

Check to see if the path exists in the ":/VFS_stdlib/" Qt resource. If it does, check the if it is an image resource ending with .jpg,.jpeg,.gif,.png,.svg, and if so, prepend a mime type to a base64 encoding of the data. Otherwise, return the raw file.

If the path doesn't exist, send an error message and call VFS_node::code() for error handling.

See also
VFS_node::code
Javascript Libraries

Reimplemented from VFS_node_interface.

Definition at line 513 of file VFS_stdlib.cpp.

◆ create()

VFS_node * VFS_stdlib::create ( QString  type,
QVariantMap  env,
QDomElement  child 
)
virtual

Create a new node instance.

Base implementation that does nothing.

Returns
The new VFS_node, or 0 (null) if it was unable to create it.

Plugins bundle groups of node definitions together. This is the factory function for creating new nodes.

For example:

VFS_node *myFancyPlugin::create(QString type, QVariantMap env, QDomElement child)
{
if (type == "myFancyNode")
{
int a = VFS_creator::configAttribute(env,child,"alpha").toInt();
QString b = VFS_creator::configAttribute(env,child,"beta",false,"beta string");
return new myFancyNode(a,b);
}
if (type == "myMagicNode")
{
QString magicPath = VFS_creator::configPathAttribute(env,child,"magicPath");
return new myMagicNode(magicPath);
}
return 0;
}
static QString configAttribute(QVariantMap env, QDomElement e, QString attr, bool req=true, QString def="")
Fetch an XML node attribute value and resolve it against an environment.
static QString configPathAttribute(QVariantMap env, QDomElement e, QString attr, bool req=true, QString def="")
Fetch an XML node attribute value and resolve it against an environment, ensuring it is a cleaned pat...
VFS_node is the base class from which all other VFS_node classes derive.
Definition: VFS_node.h:143

Please note the entries for a config file:

<myFancyNode name='fancy1' alpha='10' beta='gamma' />
<myMagicNode name='magic_thing' magicPath='/mnt/magic' />

As a pure virtual function, this must be implemented in all plugins.

See also
The Skeleton Plugin
Parameters
typeThe node type, as listed in provides() and referenced in a config.xml
envThe constructor environment
childThe config DOM element
Returns
Always returns a nullptr

Subclasses must implement this for a plugin to be useful. This base implementation is present so that a minimal plugin can implement initialize() without providing any nodes.

Reimplemented from VFS_node_interface.

Definition at line 307 of file VFS_stdlib.cpp.

◆ description()

QString VFS_stdlib::description ( QString  type)
virtual

Descriptive text about an individual node.

Parameters
typeThe node name
Returns
The description string.

The implementation of this pure method will look something like:

QString skeletonPlugin::description(QString type)
{
if (type == "skeleton")
return "A node provided as an example for the documentation. It does nothing.";
}
virtual QString description(QString type)
Descriptive text about an individual node.
See also
The Skeleton Plugin

Reimplemented from VFS_node_interface.

Definition at line 109 of file VFS_stdlib.cpp.

◆ initialize()

bool VFS_stdlib::initialize ( )
virtual

Register the browser and vfsclient types.

Returns
success = true

Any entry that is a directory must end with a slash.

Reimplemented from VFS_node_interface.

Definition at line 45 of file VFS_stdlib.cpp.

◆ licensed()

bool VFS_stdlib::licensed ( QString  type)
virtual

Check remoto licensing.

Parameters
typeThe node type
Returns
boolean Licensing state

Remoto itself will use node creation as a licensing mechanism.

Warning
This is currently unimplemented, and returns a hardcoded true for all nodes.

Reimplemented from VFS_node_interface.

Definition at line 267 of file VFS_stdlib.cpp.

◆ provides()

QStringList VFS_stdlib::provides ( )
virtual

A string list of node names that this plugin is prepared to create.

Base implementation that returns an empty list.

Returns
The list of nodes

Plugins bundle groups of node definitions together. This is the list of nodes.

For example:

QStringList myFancyPlugin::provides()
{
QStringList p;
p << "myFancyNode";
p << "myMagicNode";
return p;
}

As a pure virtual function, this must be implemented in all plugins.

See also
The Skeleton Plugin
Returns
An empty list

Subclasses must implement this for a plugin to be useful. This base implementation is present so that a minimal plugin can implement initialize() without providing any nodes.

Reimplemented from VFS_node_interface.

Definition at line 276 of file VFS_stdlib.cpp.


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