Skip to content

Commit 65f4bf1

Browse files
authored
Merge pull request #7514 from rldhont/server-cache-manager
[Server][Feature][needs-docs] Server cache manager and WMTS service
2 parents 2810c92 + b3f9898 commit 65f4bf1

File tree

69 files changed

+7507
-1694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+7507
-1694
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/server/qgsservercachefilter.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
14+
15+
class QgsServerCacheFilter
16+
{
17+
%Docstring
18+
Class defining cache interface for QGIS Server plugins.
19+
20+
.. versionadded:: 3.4
21+
%End
22+
23+
%TypeHeaderCode
24+
#include "qgsservercachefilter.h"
25+
%End
26+
public:
27+
28+
QgsServerCacheFilter( const QgsServerInterface *serverInterface );
29+
%Docstring
30+
Constructor
31+
QgsServerInterface passed to plugins constructors
32+
and must be passed to QgsServerCacheFilter instances.
33+
%End
34+
35+
virtual ~QgsServerCacheFilter();
36+
37+
virtual QByteArray getCachedDocument( const QgsProject *project, const QgsServerRequest &request, const QString &key ) const;
38+
%Docstring
39+
Returns cached document (or 0 if document not in cache) like capabilities
40+
41+
:param project: the project used to generate the document to provide path
42+
:param request: the request used to generate the document to provider parameters or data
43+
:param key: the key provided by the access control to identify different documents for the same request
44+
45+
:return: QByteArray of the cached document or an empty one if no corresponding document found
46+
%End
47+
48+
virtual bool setCachedDocument( const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, const QString &key ) const;
49+
%Docstring
50+
Updates or inserts the document in cache like capabilities
51+
52+
:param doc: the document to cache
53+
:param project: the project used to generate the document to provide path
54+
:param request: the request used to generate the document to provider parameters or data
55+
:param key: the key provided by the access control to identify different documents for the same request
56+
57+
:return: true if the document has been cached
58+
%End
59+
60+
virtual bool deleteCachedDocument( const QgsProject *project, const QgsServerRequest &request, const QString &key ) const;
61+
%Docstring
62+
Deletes the cached document
63+
64+
:param project: the project used to generate the document to provide path
65+
:param request: the request used to generate the document to provider parameters or data
66+
:param key: the key provided by the access control to identify different documents for the same request
67+
68+
:return: true if the document has been deleted
69+
%End
70+
71+
virtual bool deleteCachedDocuments( const QgsProject *project ) const;
72+
%Docstring
73+
Deletes all cached documents for a QGIS project
74+
75+
:param project: the project used to generate the documents to provide path
76+
77+
:return: true if the documents have been deleted
78+
%End
79+
80+
virtual QByteArray getCachedImage( const QgsProject *project, const QgsServerRequest &request, const QString &key ) const;
81+
%Docstring
82+
Returns cached image (or 0 if document not in cache) like tiles
83+
84+
:param project: the project used to generate the image to provide path
85+
:param request: the request used to generate the image to provider parameters or data
86+
:param key: the key provided by the access control to identify different images for the same request
87+
88+
:return: QByteArray of the cached image or an empty one if no corresponding image found
89+
%End
90+
91+
virtual bool setCachedImage( const QByteArray *img, const QgsProject *project, const QgsServerRequest &request, const QString &key ) const;
92+
%Docstring
93+
Updates or inserts the image in cache like tiles
94+
95+
:param img: the document to cache
96+
:param project: the project used to generate the image to provide path
97+
:param request: the request used to generate the image to provider parameters or data
98+
:param key: the key provided by the access control to identify different images for the same request
99+
100+
:return: true if the image has been cached
101+
%End
102+
103+
virtual bool deleteCachedImage( const QgsProject *project, const QgsServerRequest &request, const QString &key ) const;
104+
%Docstring
105+
Deletes the cached image
106+
107+
:param project: the project used to generate the image to provide path
108+
:param request: the request used to generate the image to provider parameters or data
109+
:param key: the key provided by the access control to identify different images for the same request
110+
111+
:return: true if the image has been deleted
112+
%End
113+
114+
virtual bool deleteCachedImages( const QgsProject *project ) const;
115+
%Docstring
116+
Deletes all cached images for a QGIS project
117+
118+
:param project: the project used to generate the images to provide path
119+
120+
:return: true if the images have been deleted
121+
%End
122+
123+
};
124+
125+
typedef QMultiMap<int, QgsServerCacheFilter *> QgsServerCacheFilterMap;
126+
127+
/************************************************************************
128+
* This file has been generated automatically from *
129+
* *
130+
* src/server/qgsservercachefilter.h *
131+
* *
132+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
133+
************************************************************************/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/server/qgsservercachemanager.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
14+
class QgsServerCacheManager
15+
{
16+
%Docstring
17+
A helper class that centralizes caches accesses given by all the server cache filter plugins.
18+
19+
.. versionadded:: 3.4
20+
%End
21+
22+
%TypeHeaderCode
23+
#include "qgsservercachemanager.h"
24+
#include "qgsservercachefilter.h"
25+
%End
26+
public:
27+
QgsServerCacheManager();
28+
%Docstring
29+
Constructor
30+
%End
31+
32+
QgsServerCacheManager( const QgsServerCacheManager &copy );
33+
%Docstring
34+
Copy constructor
35+
%End
36+
37+
38+
~QgsServerCacheManager();
39+
40+
bool getCachedDocument( QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
41+
%Docstring
42+
Returns cached document (or 0 if document not in cache) like capabilities
43+
44+
:param doc: the document to update by content found in cache
45+
:param project: the project used to generate the document to provide path
46+
:param request: the request used to generate the document to provider parameters or data
47+
:param accessControl: the access control to identify different documents for the same request provided by server interface
48+
49+
:return: true if the document has been found in cache and the document's content set
50+
%End
51+
52+
bool setCachedDocument( const QDomDocument *doc, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
53+
%Docstring
54+
Updates or inserts the document in cache like capabilities
55+
56+
:param doc: the document to cache
57+
:param project: the project used to generate the document to provide path
58+
:param request: the request used to generate the document to provider parameters or data
59+
:param accessControl: the access control to identify different documents for the same request provided by server interface
60+
61+
:return: true if the document has been cached
62+
%End
63+
64+
bool deleteCachedDocument( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
65+
%Docstring
66+
Deletes the cached document
67+
68+
:param project: the project used to generate the document to provide path
69+
:param request: the request used to generate the document to provider parameters or data
70+
:param accessControl: the access control to identify different documents for the same request provided by server interface
71+
72+
:return: true if the document has been deleted
73+
%End
74+
75+
bool deleteCachedDocuments( const QgsProject *project ) const;
76+
%Docstring
77+
Deletes all cached documents for a QGIS project
78+
79+
:param project: the project used to generate the document to provide path
80+
81+
:return: true if the document has been deleted
82+
%End
83+
84+
QByteArray getCachedImage( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
85+
%Docstring
86+
Returns cached image (or 0 if image not in cache) like tiles
87+
88+
:param project: the project used to generate the image to provide path
89+
:param request: the request used to generate the image to provider parameters or data
90+
:param accessControl: the access control to identify different documents for the same request provided by server interface
91+
92+
:return: the cached image or 0 if no corresponding image found
93+
%End
94+
95+
bool setCachedImage( const QByteArray *img, const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
96+
%Docstring
97+
Updates or inserts the image in cache like tiles
98+
99+
:param img: the image to cache
100+
:param project: the project used to generate the image to provide path
101+
:param request: the request used to generate the image to provider parameters or data
102+
:param accessControl: the access control to identify different documents for the same request provided by server interface
103+
104+
:return: true if the image has been cached
105+
%End
106+
107+
bool deleteCachedImage( const QgsProject *project, const QgsServerRequest &request, QgsAccessControl *accessControl ) const;
108+
%Docstring
109+
Deletes the cached image
110+
111+
:param project: the project used to generate the image to provide path
112+
:param request: the request used to generate the image to provider parameters or data
113+
:param accessControl: the access control to identify different documents for the same request provided by server interface
114+
115+
:return: true if the image has been deleted
116+
%End
117+
118+
bool deleteCachedImages( const QgsProject *project ) const;
119+
%Docstring
120+
Deletes all cached images for a QGIS project
121+
122+
:param project: the project used to generate the images to provide path
123+
124+
:return: true if the images have been deleted
125+
%End
126+
127+
void registerServerCache( QgsServerCacheFilter *serverCache, int priority = 0 );
128+
%Docstring
129+
Register a server cache filter
130+
131+
:param serverCache: the server cache to add
132+
:param priority: the priority used to define the order
133+
%End
134+
135+
};
136+
137+
/************************************************************************
138+
* This file has been generated automatically from *
139+
* *
140+
* src/server/qgsservercachemanager.h *
141+
* *
142+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
143+
************************************************************************/

python/server/auto_generated/qgsserverinterface.sip.in

+17
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@ Register an access control filter
8383
virtual QgsAccessControl *accessControls() const = 0;
8484
%Docstring
8585
Gets the registered access control filters
86+
%End
87+
88+
virtual void registerServerCache( QgsServerCacheFilter *serverCache /Transfer/, int priority = 0 ) = 0;
89+
%Docstring
90+
Register a server cache filter
91+
92+
:param serverCache: the server cache to register
93+
:param priority: the priority used to order them
94+
95+
.. versionadded:: 3.4
96+
%End
97+
98+
virtual QgsServerCacheManager *cacheManager() const = 0;
99+
%Docstring
100+
Gets the registered server cache filters
101+
102+
.. versionadded:: 3.4
86103
%End
87104

88105
virtual QString getEnv( const QString &name ) const = 0;

python/server/auto_generated/qgsserverprojectutils.sip.in

+11
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,17 @@ Returns the Layer ids list defined in a QGIS project as published in WCS.
413413
:param project: the QGIS project
414414

415415
:return: the Layer ids list.
416+
%End
417+
418+
QString wmtsServiceUrl( const QgsProject &project );
419+
%Docstring
420+
Returns the WMTS service url defined in a QGIS project.
421+
422+
:param project: the QGIS project
423+
424+
:return: url if defined in project, an empty string otherwise.
425+
426+
.. versionadded:: 3.4
416427
%End
417428
};
418429

python/server/server_auto.sip

+6
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@
2929
%If ( HAVE_SERVER_PYTHON_PLUGINS )
3030
%Include auto_generated/qgsaccesscontrol.sip
3131
%End
32+
%If ( HAVE_SERVER_PYTHON_PLUGINS )
33+
%Include auto_generated/qgsservercachefilter.sip
34+
%End
35+
%If ( HAVE_SERVER_PYTHON_PLUGINS )
36+
%Include auto_generated/qgsservercachemanager.sip
37+
%End

0 commit comments

Comments
 (0)