Commit graph

20 commits

Author SHA1 Message Date
Ashod Nakashian
c82cf3cc45 wsd: quarantine: thread-safe quarantining
The QuarantineMap is shared between DocBroker
instances, which makes it subject to concurrent
access and modification. As such, it must be
protected via a lock.

Change-Id: Id62587b33123748f848110a5427da3e296725de9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
8f1354dc91 wsd: quarantine: size calculation
Change-Id: I97d87afd7b5769c76c0112faa4fa90449a1940d4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
a9562dc3f2 wsd: quarantine: better filename tokenization
Change-Id: I0ddac3ba63cc1aa1bd8dfffd7ccb3a50013f8bd4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
eaf69c8b19 wsd: quarantine: simplify the filename
Change-Id: I83e0fb9da054063af822541805bfe92d460affbd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
203cc2f97f wsd: quarantine: delayed construction of the quarantine instance
Since we need both the PID of the kit process and
the document name, it's easier to construct the
quarantine instance only when we have downloaded
the document.

Change-Id: I8b537122c4b10ae6e822a82fa6a75456d0eaaaff
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
6ed935bf89 wsd: quarantine: encapsulate QuarantineMap
Change-Id: I8b4da2cb4c2291c70f6a0d513a72f47899428e3e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
81b452b225 wsd: quarantine: include correction
config.h should only be included in .cpp files,
never in headers. The reason is to avoid having
it accidentally included, which would also
allow for it being effective only in subsequent
code, not those included earlier.

To avoid these problems, each .cpp includes
config.h at the top, so the configuration
directives would be effective throughout
the translation unit.

Change-Id: Idae87e5ee51abe454cc2a53d6f60dc07f64d0c35
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
b81db549dd wsd: quarantine: capture the maximum quarantined file versions
Change-Id: Ie2756580954ed759e250340b786ae602d213b321
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
8fa978139f wsd: quarantine: capture the maximum age of quarantined files
Change-Id: I36f681ec5672d77e15ef6a9104d1b3ad874b189d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
99baf40e7e wsd: quarantine: capture the maximum quarantine size
Change-Id: If30f0b7349e6605708e2bd5821b6e25558fba104
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
799b704e32 wsd: quarantine: capture DocKey
Change-Id: Ic22ac58210bad27d9a02d589828151548c4a1bd0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
6ab3bbbd09 wsd: quarantine: capture the document name
Change-Id: Id308a80e2d504d82e021e7333b78488dabbac687
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
08967941a3 wsd: quarantine: capture const values
Change-Id: I67233c8d5bbd0cf63133e6643dd0106c4c3bcae6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
0c0d7071ab wsd: quarantine: minimize explicit arg passing
Change-Id: I7b18abc96ccf0a217a806cf2259c539964bad553
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
3825205042 wsd: quarantine: more encapsulation
Change-Id: Ifed497ad246fa9fb4a3d349aa579ce6e88793066
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
7ea3495f22 wsd: quarantine: convert Quarantine to a class
Change-Id: I9478f35e6c7c3f156aa15072e31c38bc84dc2b64
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
3c5a6963fe wsd: quarantine: encapsulate the quarantine path
Change-Id: I738a06b3a272a049ef8772fa0502a7f2de03c881
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
bd4589d142 wsd: quarantine: cleanup quarantined files when unloading cleanly
Change-Id: I1934bca783f94847c73e9c47d0e8c703dbe75a99
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-05-15 08:47:26 +01:00
Ashod Nakashian
5757c17b6b wsd: clang-tidy fixes
Also, reduce public function surface-area.

Change-Id: Ia922e19c49a731a83bbd3d1dc645355926ddba3c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-04 10:26:49 -05:00
Pranam Lashkari
f84df1161c quarantine: create hard links for quarantining when file is saved
number of versions to maintain per file can be specified in loolwsd.xml
on exceeding specified quarantine size oldest file(s) is deleted

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I3ca55b9ab29a82988f19fe0acd43e0fae2c2a423
2021-11-01 17:21:51 +02:00