Remoto - VFS: VFS_sessionManager.h Source File
Remoto - VFS
VFS_sessionManager.h
Go to the documentation of this file.
1 #ifndef VFS_SESSIONMANAGER_H
2 #define VFS_SESSIONMANAGER_H
3 
4 #include <QFuture>
5 
6 #include "VFS_base/VFS_node.h"
7 
9 {
10  Q_OBJECT
11 
12  public:
13  VFS_sessionTokenPruner(QString path);
14  virtual ~VFS_sessionTokenPruner();
15 
16  bool run();
17  void stop();
18  bool running();
19 
20  protected:
21 
22  //virtual void subscribe(VFS_request *r);
23  //virtual void unsubscribe(VFS_request *r);
24 
25  //virtual void ls(VFS_request *r);
26  //virtual void read(VFS_request *r);
27  //virtual void write(VFS_request *r);
28  //virtual void metadata(VFS_request *r);
29  //virtual void report(VFS_request *r);
30  //virtual void submit(VFS_request *r);
31  //virtual void rm(VFS_request *r);
32  //virtual void requestLock(VFS_request *r);
33  //virtual void releaseLock(VFS_request *r);
34 
35  private:
36  bool _running;
37  QString _path;
38 
39  QStringList _pathList;
40 
41  void peel();
42  bool checkEntry(QJsonObject e);
43  void pruneEntry(QString p);
44 
45  signals:
46 
47  public slots:
48 
49  protected slots:
50  virtual void receiveResponse(VFS_request *t);
51 };
52 
54 {
55  Q_OBJECT
56 
57  public:
58  Q_INVOKABLE explicit VFS_sessionManager(QString cwd, QString userdata, qint64 ttl, QString tokendata="", QString developerGroup="", double pruneProbability=0.1); //or should developerGroup default to "developer"?
59  virtual ~VFS_sessionManager();
60 
61  virtual VFS_node *find(VFS_request *r);
62 
63  virtual QString reportDetails();
64  virtual QString getCWD();
65 
66  protected:
67  virtual QByteArray icon();
68 
69  //virtual void subscribe(VFS_request *r);
70  //virtual void unsubscribe(VFS_request *r);
71 
72  //virtual void ls(VFS_request *r);
73  virtual void read(VFS_request *r);
74  virtual void write(VFS_request *r);
75  //virtual void metadata(VFS_request *r);
76  //virtual void report(VFS_request *r);
77  //virtual void submit(VFS_request *r);
78  //virtual void rm(VFS_request *r);
79  //virtual void requestLock(VFS_request *r);
80  //virtual void releaseLock(VFS_request *r);
81 
82  QString _cwd;
83  QString _userdata;
84  QString _tokendata;
85  qint64 _ttl;
86  QString _developerGroup;
88 
89  private:
92 
93  QString generateAuthtoken();
94  void pruneTokens();
95 
96  signals:
97 
98  public slots:
99 
100  protected slots:
101  virtual void receiveResponse(VFS_request *t);
102 };
103 
104 #endif // VFS_SESSIONMANAGER_H
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
VFS_sessionManager manages connected clients and their session data.
VFS_sessionTokenPruner _pruner
Our pruner.
QString _cwd
The VFS path of this node.
virtual void receiveResponse(VFS_request *t)
VFS_sessionManager::receiveResponse.
Q_INVOKABLE VFS_sessionManager(QString cwd, QString userdata, qint64 ttl, QString tokendata="", QString developerGroup="", double pruneProbability=0.1)
Create a session node, whose job is to return session data for a user.
qint64 _ttl
Number of seconds for sessions to live once created (time to live)
virtual void read(VFS_request *r)
Read from the sessionManager.
QString _tokendata
A VFS path to store session tokens.
virtual VFS_node * find(VFS_request *r)
Find a node using a VFS_request.
VFS_node * _sessions
A VFS_node to hold current sessions.
double _pruneProbability
The probability that a prune will happen.
virtual void write(VFS_request *r)
Write to the session manager to create a session.
QString _userdata
A VFS path to store user data.
QString _developerGroup
Name of the group used for development mode. Members of this group will have additional preferences a...
QString generateAuthtoken()
Generate a new unique authtoken for this session.
virtual QByteArray icon()
Return the user icon from VFS_icons.
virtual QString getCWD()
Return the manager's _cwd value.
virtual QString reportDetails()
Return information about any current sessions.
void pruneTokens()
Run a session token prune on a separate thread.
VFS_sessionTokenPruner(QString path)
Create a VFS_sessionTokenPruner.
void pruneEntry(QString p)
Request to remove a token entry.
virtual void receiveResponse(VFS_request *t)
Receive a response on a pruner request.
QString _path
The VFS path to prune.
QStringList _pathList
The list of paths remaining to check.
bool checkEntry(QJsonObject e)
Check a token entry for validity.
bool running()
Return the _running state of the pruner.
void stop()
Stop the prune operation if it is running.
virtual ~VFS_sessionTokenPruner()
Destroy the pruner.
void peel()
Remove a path from the stack or stop processing if empty.
bool run()
Attempt to run the prune operation.
bool _running
The running state of the pruner.