Commit Graph

29 Commits

Author SHA1 Message Date
FinnStutzenstein
5aef823807 Major cache rewrite:
- Removed the restricted data cache (it wasn't used since OS 3.0)
- unify functions for restricted and full data: Just one function, which
  accteps an optional user_id: If it is None, full data is returned, and
  with a user id given, the restricted data
- More atomic access to redis, especially for:
- Check for data-existance in redis and do an auto-ensure-cache.
- Speedup through hashing of scripts and redis' script cache.
- Save schema version into the redis cache and rebuild, if the version
  changed

Client changes:
- Simplified the ConstantsService
- Fixed bug, when receiving an autoupdate with all_data=True from the
  Server
2019-08-08 08:35:02 +02:00
FinnStutzenstein
b7e98a565a Fix restriction without restricted data cache 2019-06-25 16:57:29 +02:00
FinnStutzenstein
171f05e7b8 Logging the cache buildup process 2019-05-10 14:20:01 +02:00
Oskar Hahn
206eb9bcba decode only the needed data when calculating the required users 2019-03-29 22:38:12 +01:00
Oskar Hahn
dd4754d045 Disable the future-lock when updating the restircted data cache
Before this commit, there where two different locks when updating the restricted
data cache. A future lock, what is faster but only works in the same thread. The
other lock is in redis, it is not so fast, but also works in many threads.

The future lock was buggy, because on a second call of update_restricted_data
the same future was reused. So on the second run, the future was already done.

I don't see any way to delete. The last client would have to delete it, but there
is no way to find out which client the last one is.
2019-03-04 21:37:00 +01:00
Oskar Hahn
fae270a1d6 Make sure the cache is ensured before manipulating it 2019-02-04 17:41:18 +01:00
Oskar Hahn
1111a8074e fix restricted_data_cache for elements that exists, but a user is not allowed to see them 2019-02-01 08:26:34 +01:00
Oskar Hahn
b329115007 use f-string syntax for strings 2019-01-18 17:37:36 +01:00
Oskar Hahn
a0f554674b New projector system. Add first slides 2019-01-12 21:21:43 +01:00
Oskar Hahn
eddbd86d3a Run black 2019-01-08 21:51:52 +01:00
Oskar Hahn
eead4efe6a Remove CollectionElement
* Use user_id: int instead of Optional[CollectionElment] in utils
* Rewrote autoupdate system without CollectionElement
2018-11-04 01:06:01 +01:00
Oskar Hahn
cd34d30866 Remove utils.collections.Collection class and other cleanups
* Activate restricted_data_cache on inmemory cache
* Use ElementCache in rest-api get requests
* Get requests on the restapi return 404 when the user has no permission
* Added async function for has_perm and in_some_groups
* changed Cachable.get_restricted_data to be an ansync function
* rewrote required_user_system
* changed default implementation of access_permission.check_permission to
  check a given permission or check if anonymous is enabled
2018-11-03 20:48:19 +01:00
Oskar Hahn
c405b4b323 Use Protocol instead of ABC in cache_provicer 2018-10-28 10:37:16 +01:00
Oskar Hahn
b9e24016c1 Add test for second getElement request 2018-10-27 14:56:22 +02:00
Oskar Hahn
bc442210fb Improve redis cache
* delete only keys with prefix
* Make redis_provider atomic with transactions and lua scripts
* improve lock
* generate change_id in redis to make sure it is uniq
* use miliseconds as starttime
* add argument use max_change_id to get_{full|resticted}_data
2018-10-15 23:37:26 +02:00
Oskar Hahn
9af6bf1606 ensures test on startup 2018-09-23 16:57:49 +02:00
Oskar Hahn
aac9dcabf5 drop python 3.5 2018-08-23 17:51:30 +02:00
Oskar Hahn
10b3bb6497 Update to channels 2
* geis does not work with channels2 and never will be (it has to be python now)
* pytest
* rewrote cache system
* use username instead of pk for admin user in tests
2018-08-22 06:30:11 +02:00
FinnStutzenstein
2989024cca Delete restricted data cache on permission changes (closes #3396) 2018-05-16 10:59:00 +02:00
Oskar Hahn
5aa8f6193e Add methods to delete the restricted_data_cache 2018-02-24 18:04:32 +01:00
Emanuel Schütze
279c2ba796 Adds elements to restricted data cache only if cache already exists (hotfix for #3427).
Prevents corrupt cache if restricted data cache is cleared while runtime.
2017-11-12 17:39:46 +01:00
Oskar Hahn
d7db714562 CollectionElement and Autoupdate cleanups
* change get_restricted_data and get_projector_data to always use a list
* Add typings to all get_restricted_data and get_projector_data methods
* Replace CollectionElementList with a real list
* Fixed arguments of inform_deleted_data
* Moved CollectionElementCache to cache.py and refactored it
* Run tests with cache enabled (using fakeredis)
2017-09-15 12:11:32 +02:00
Oskar Hahn
faf44602cb Make RestrictedDataCache optional 2017-09-15 09:55:21 +02:00
Oskar Hahn
0978cfd5d5 Add restricted_data_cache
This replaces the startup cache
2017-09-06 18:06:57 +02:00
Oskar Hahn
be94e97889 more typings 2017-09-03 18:34:55 +02:00
Oskar Hahn
9d1ebac86e Add typing (#3370)
Add typing
2017-08-23 20:51:06 +02:00
Norman Jäckel
ebabc291c5 Refactoring of data parsing for startup and autoupdate. 2017-05-03 08:58:29 +02:00
Oskar Hahn
4963bfa7bf Changed restricted data parsing. Cached full data on startup. 2017-05-01 21:52:16 +02:00
Oskar Hahn
728576d514 Performance improvements
* Add caching support to users/group
* Add a function has_perm that works with the cache.
* Removed our session backend so other session backends (without the database) can be used
2017-01-13 13:37:18 +01:00