Remoto - VFS: VFS_tcp_mount.h Source File
Remoto - VFS
VFS_tcp_mount.h
Go to the documentation of this file.
1 #ifndef VFS_TCP_MOUNT_H
2 #define VFS_TCP_MOUNT_H
3 
4 #include <QTimer>
5 
8 
9 //every 5 minutes, send a pulse to keep the connection alive.
10 #define VFS_TCP_MOUNT_PING_TIME_MS (1000*60*5)
11 
13 {
14  Q_OBJECT
15 
17  friend class VFS_tcp_export_client;
18  friend class aclEditor;
19 
20  public:
21  Q_INVOKABLE VFS_tcp_mount(QString name, QString path, QString address, quint16 port, quint16 interval=3000, bool ssl=false, QString sslCertPath="");
22  virtual ~VFS_tcp_mount();
23 
24  virtual VFS_node *find(VFS_request *r);
25 
26  virtual bool isContainer();
27 
28  void refreshSubscriptions();
29  bool isMounted();
30  QString path();
31 
32  protected:
33  QString _name;
34  QString _path;
36  int _timerID;
37  bool _mounted;
38 
40  QMap<postID, VFS_request *> _requests;
42 
43  QList<VFS_request *> _unmountedRequests;
44  void sendUnmountedRequests();
45 
46  void issueUnmounted();
47  void issueMounted(QString path);
48 
50 
51  QTimer _ping;
52 
53  static QMutex _mountsLock;
54  static QList<VFS_tcp_mount *> _mounts;
55 
56  void timerEvent(QTimerEvent *e=nullptr);
57  void attemptConnection();
58 
59  virtual QByteArray icon();
60 
61  private:
62  // virtual void ls(VFS_request *r);
63  // virtual void read(VFS_request *r);
64  // virtual void write(VFS_request *r);
65  // virtual void metadata(VFS_request *r);
66  // virtual void report(VFS_request *r);
67  // virtual void submit(VFS_request *r);
68  // virtual void rm(VFS_request *r);
69 
70  void sendMessage( QByteArray message );
71 
72  signals:
73 
74  public slots:
75  void init();
76 
77  virtual void executeRequest(VFS_request *r);
78 
79  virtual void unsubscribeAll(VFS_node *n);
80 
81  protected slots:
82  virtual void startConnecting();
83  virtual void stopConnecting();
84 
85  virtual void startPing();
86  virtual void stopPing();
87  virtual void sendPing();
88 
89  virtual void receiveMessage(QByteArray message);
90 };
91 
92 #endif // VFS_TCP_MOUNT_H
93 
quint16 postID
Definition: VFS_node.h:24
VFS_node is the base class from which all other VFS_node classes derive.
Definition: VFS_node.h:143
The base class for all requests between nodes.
Definition: VFS_node.h:54
The socket client created by VFS_tcp_export.
A VFS_node_interface implementation used to route code requests to other VFS instances.
The VFS_tcp_mount class is a client side connection that will attempt to connect to another VFS insta...
Definition: VFS_tcp_mount.h:13
void timerEvent(QTimerEvent *e=nullptr)
DOCME.
void issueUnmounted()
VFS_tcp_mount::issueUnmounted.
QString _path
The path to this node.
Definition: VFS_tcp_mount.h:34
void attemptConnection()
DOCME.
static QList< VFS_tcp_mount * > _mounts
The list of existing mounts.
Definition: VFS_tcp_mount.h:54
virtual void stopPing()
DOCME.
QTimer _ping
The ping timer object.
Definition: VFS_tcp_mount.h:51
void sendUnmountedRequests()
DOCME.
postID _currentID
The current VFS_request_id.
Definition: VFS_tcp_mount.h:39
void refreshSubscriptions()
Resubscribe to what had been previously subscribed.
virtual QByteArray icon()
Fetch the icon for this node.
void sendMessage(QByteArray message)
send a message over the line
int _timerID
The ID of the connection timer.
Definition: VFS_tcp_mount.h:36
bool isMounted()
Return the state of _mounted.
virtual void startPing()
DOCME.
QString _name
The name of this node for logging purposes.
Definition: VFS_tcp_mount.h:33
bool _mounted
Is this mounted?
Definition: VFS_tcp_mount.h:37
virtual void sendPing()
DOCME.
void issueMounted(QString path)
VFS_tcp_mount::issueMounted.
QMap< postID, VFS_request * > _requests
Outstanding VFS_requests.
Definition: VFS_tcp_mount.h:40
virtual ~VFS_tcp_mount()
postID getNewRequestID()
DOCME.
virtual void startConnecting()
DOCME.
virtual void unsubscribeAll(VFS_node *n)
Remove all references to a subscriber from this node.
QString path()
Return the path to this node.
virtual void receiveMessage(QByteArray message)
virtual VFS_node * find(VFS_request *r)
Always return 'this'.
virtual bool isContainer()
virtual void stopConnecting()
DOCME.
static QMutex _mountsLock
A mutex for modifying the _mounts entry.
Definition: VFS_tcp_mount.h:53
virtual void executeRequest(VFS_request *r)
DOCME.
VFS_tcp_mount_directory _codeDirectory
The directory of code available when mounted.
Definition: VFS_tcp_mount.h:49
QList< VFS_request * > _unmountedRequests
Requests to submit when re-mounted.
Definition: VFS_tcp_mount.h:43
int _attemptInterval
The interval to attempt (re)connections.
Definition: VFS_tcp_mount.h:35
Q_INVOKABLE VFS_tcp_mount(QString name, QString path, QString address, quint16 port, quint16 interval=3000, bool ssl=false, QString sslCertPath="")
VFS_tcp_mount constructor.
void init()
DOCME.
An editor for ACL files.
Definition: aclEditor.h:7