Commit Graph

20 Commits

Author SHA1 Message Date
Martchus 5d5b673b3c Improve updating package database when loading library dependencies
* Make use of `PackageUpdater` more efficient by avoiding multiple calls of
  `addDepsAndProvidesFromOtherPackage`
* Fix leaving old provides in the database by splitting the update via new
  `beginUpdate()` and `endUpdate()` functions
2023-12-21 20:51:38 +01:00
Martchus 8deeb0a82b Remove non-forcing package updates
This was only used in tests but was otherwise not very useful as we
normally need to ensure the persistent database is updated as well.
2023-12-19 21:34:18 +01:00
Martchus 303d0bd17b Clear entries from package cache correctly 2023-12-17 01:41:13 +01:00
Martchus 407e3159e0 Update/remove packages from database in a whole transaction 2022-11-01 15:46:10 +01:00
Martchus 9f5474e128 Fix passing architecture when creating database
When adding a new database when reloading the config at runtime the
architecture must be passed when creating the database. Otherwise we end up
with the new database sharing the internal storage with the x86_64 database
which leads to very confusing behavior.
2022-06-19 23:06:25 +02:00
Martchus 6699bfa49e lmdb: Avoid storing empty keys possibly leading to `MDB_BAD_VALSIZE`
This might prevent errors like:

```
Unable to parse retrieved database file for "community-staging@x86_64": Getting data: MDB_BAD_VALSIZE: Unsupported size of key/DB name/data, or wrong DUPFIXED size
```
2022-03-10 22:45:11 +01:00
Martchus 7ade757c8d Avoid locking whole config when updating DBs
* Only lock the config for writing the reloading the config file
* Make sure all write operations to the database acquire an "update mutex"
  to ensure only one write operation happens at a time
* Do *not* acquire any additional locks when reading from a database as it
  should be safe to do so even when a write operation happens because
    * LMDB read and write transactions can happen at the same time
    * The package cache has its own mutex anyways
    * Write ops to the package cache try to lock the "update mutex" to
      prevent writing "old" data to the cache during updates
* Make "lastUpdate" atomic to avoid locking the config when accessing it
2022-03-05 18:55:52 +01:00
Martchus c2e7f40767 Fix typos 2022-03-01 00:43:06 +01:00
Martchus 9e15129d9d Ignore null-dereference warning
It is about
```
return result_type{ storageEntry.id, storageEntry.ref.relatedStorage };
```
but it isn't clear why the compiler thinks there's a problem.
2022-02-22 22:46:53 +01:00
Martchus d11ba43bf0 lmdb: Avoid getting packages with empty name, can lead to exception 2022-02-20 19:28:44 +01:00
Martchus d1d65dac80 Use `CacheRef(storage, entry)` c'tor as it is generally preferred
Passing any string here is more likely a mistake, see previous commit
2022-02-01 22:59:09 +01:00
Martchus 2a256e6ac1 Fix using dangling ref of package name as hash key 2022-02-01 22:57:13 +01:00
Martchus 66f59fecb9 Make storing lib deps more efficient and allow for intermediate reads 2022-01-31 21:32:07 +01:00
Martchus 45922b47ec lmdb: Allow configuring cache limit 2022-01-26 00:41:53 +01:00
Martchus fe09463b0a lmdb: Fix replacing existing packages when updating package via cache 2022-01-25 00:04:25 +01:00
Martchus f088e54c61 lmdb: Use package cache when querying packages for dependencies
* Use package cache when querying packages for dependencies or library
  names
* Avoid manual instantiations of `std::shared_ptr<Package>`
2022-01-21 20:35:43 +01:00
Martchus f73753792c lmdb: Use caching when finding package via ID 2022-01-20 23:33:02 +01:00
Martchus 231571f2d1 lmdb: Generalize caching to be able to use it for other types than packages 2022-01-19 23:33:07 +01:00
Martchus fc32f790fb lmdb: Use namespace and have reflective-rapidjson code in its own header 2022-01-18 22:25:28 +01:00
Martchus 2ffa6629c8 lmdb: Use lmdb to store packages and dependency indices 2022-01-18 21:50:53 +01:00