about summary refs log tree commit diff
path: root/src/database/mod.rs
Commit message (Collapse)AuthorAgeFilesLines
* Introduce `Storage::update_with`Vika2024-08-281-1/+25
| | | | | | | | | This function takes a closure that modifies the post. This could be useful in maintenance utilities that scan and fixup posts. For now this isn't used anywhere within Kittybox, but once all backends implement this correctly, this could replace `Storage::update_post` calls. For supporting backends, `Storage::update_post` is implemented in terms of `Storage::update_with`.
* Set MSRV to 1.75, remove #[async_trait] declarations whenever possibleVika2024-08-261-26/+25
| | | | | | | Axum still uses `async_trait`, let them do whatever they want. I will no longer be subject to the humiliation of trying to dig through lifetime errors and unreadable declarations. Also I don't fucking care about MSRV, I'm not a library. If you don't have modern Rust, get one.
* Appease most clippy warningsVika2024-08-261-6/+3
| | | | | | The warnings only remain in places where I need them to remain, because I either need a reminder to implement something, or I need to refactor and simplify the code in question.
* FileStorage: appease clippy and use block_in_place for rewinding feedsVika2024-08-261-1/+1
| | | | | Using `tokio::task::block_in_place` downgrades the thread temporarily to avoid starvation.
* kittybox-util: 0.1.0 -> 0.2.0Vika2024-08-201-1/+1
| | | | Micropub types are now more coherent and gathered in one place.
* feat: logins!!Vika2024-08-181-1/+1
| | | | | | | | yes you can finally sign in this is also supposed to show private posts intended for you! maybe i can also reveal my email to those who sign in! :3
* treewide: create a common method for state initializationVika2024-08-011-5/+5
| | | | | Now the database objects can be uniformly created from a URI. They can also optionally do sanity checks and one-time initialization.
* database: use Url to represent user authoritiesVika2024-07-091-17/+17
| | | | This makes the interface more consistent and resistant to misuse.
* Support ?q=category queriesVika2024-03-041-1/+4
| | | | Warning, untested. But hopefully works!
* Moved the entire Kittybox tree into the rootVika2023-07-291-0/+793
|
* flake.nix: reorganizeVika2022-05-241-539/+0
| | | | | | | | | | | | - Kittybox's source code is moved to a subfolder - This improves build caching by Nix since it doesn't take changes to other files into account - Package and test definitions were spun into separate files - This makes my flake.nix much easier to navigate - This also makes it somewhat possible to use without flakes (but it is still not easy, so use flakes!) - Some attributes were moved in compliance with Nix 2.8's changes to flake schema
* database, frontend: code cleanup so clippy doesn't complainVika2022-05-101-5/+6
|
* FileStorage: fixes and regression tests for read_feed_with_limitVika2022-05-101-39/+135
| | | | Now I will know if something breaks horribly again.
* Split into different cratesVika2022-05-071-9/+1
| | | | | | | | | Templates and utility types are now separate crates to speed up compilation, linting and potential reuse/replacement. Potentially more crates could be split out/modularized, resulting in speedups, smaller binaries (whenever features are excluded) and even more reuse capabilities.
* FileStorage: lockless reads and atomic writesVika2022-05-011-1/+4
| | | | | | | | | | | | | | | | | | | - Reads don't lock anymore. At all. - Writes create a temporary file and use `rename(2)` to atomically replace it - since OpenOptions::create_new(true) is used, tempfile creation is atomic (and since tempfile names are per-post, a post can only be edited by one request at a time) - Since written files get atomically replaced, readers can't read a corrupted file Potential pitfalls: 1. This approach is not covered by unit tests (yet) 2. Stale tempfiles can prevent editing posts (can be solved by throwing out tempfiles that are older than, say, a day) 3. Crashed edits can leave stale tempfiles (honestly that sounds better than corrupting the whole database, doesn't sound like a bug to me at all!)
* Make the settings in the database a strong typeVika2022-03-231-4/+18
|
* database: code cleanupVika2022-03-021-1/+6
|
* database/memory: restore, it is useful in test scenariosVika2022-02-211-0/+2
|
* database: code cleanupVika2022-02-211-35/+14
|
* WIP: convert to Tokio and WarpVika2022-02-151-32/+6
| | | | | | | | | | | Warp allows requests to be applied as "filters", allowing to flexibly split up logic and have it work in a functional style, similar to pipes. Tokio is just an alternative runtime. I thought that maybe switching runtimes and refactoring the code might allow me to fish out that pesky bug with the whole application hanging after a certain amount of requests...
* Add protected locations that are visible only to logged-in usersVika2021-12-071-1/+3
|
* Code cleanup and small bugfixing in templatesVika2021-12-051-21/+37
|
* frontend: Added listing feeds to the header barVika2021-12-051-7/+3
|
* Get rid of the unsafe codeVika2021-12-021-7/+4
| | | | | | Thanks to @Kloenk I was able to get rid of the unsafety and tell the compiler how to properly check what I needed for the StorageError to be declared thread-safe.
* Deprecated Redis backend and added a database migration tool (untested, beware)Vika2021-10-271-13/+29
|
* Code cleanup and Cargo.lock updatesVika2021-09-271-2/+3
|
* Implemented support for channelsVika2021-09-271-0/+49
|
* Moved integration tests and allowed the binary to use file backendVika2021-09-261-0/+6
| | | | | | Now the Redis dependencies are optional and only required if you want to test the backend or actually use it in production. The app displays a hint if you try to launch with an unsupported backend.
* Added file updates and fixed a bug with truncated JSON filesVika2021-09-261-0/+54
| | | | | | | | | | | There was a bug where `File::write()` would not write the entire buffer, and this condition was left unchecked by the code. All `File::write()` calls are now replaced with `File::write_all()` which ensures the whole buffer is written to the backing file. Additionally added a smoke check for the file updates. It is in no way comprehensive nor it is able to catch all the possible failures but it's a good way of testing the functionality without way too much hassle.
* Added a WIP file backendVika2021-08-151-30/+37
| | | | | | | Currently unavailable for use and only has basic GET and POST operations implemented. A lot more work is needed to make it truly usable. Locking is implemented using flock() system call on Linux.
* Fixed a VERY WRONG way to handle stream errorsVika2021-08-041-1/+9
| | | | | | for future reference: stream operations returning Result satisfy conditions for the futures::stream::TryStreamExt trait, allowing you to use `TryStreamExt::try_collect::<T>()` and receive a Result<T>.
* Appease rustfmt, clippy and cargo checkVika2021-07-291-2/+8
|
* Relaxed anti-takeover URL check to simply not place redirects at foreign URLsVika Shleina2021-07-191-3/+3
|
* Make rustfmt happyVika2021-05-171-44/+106
|
* Added setting store per-userVika2021-05-171-0/+18
|
* Refactored the Redis instance spawning in tests to automatically kill RedisVika2021-05-051-10/+6
|
* Removed the in-memory database, it's dragging me downVika2021-05-051-15/+0
|
* Moved the Redis spawner to the Redis module where it belongs, refactored ↵Vika2021-05-051-42/+10
| | | | tests to use the Redis database instead of a fake one
* Made some StorageError fields private and added getters insteadVika2021-05-051-2/+5
|
* Clippy lintsVika2021-05-041-4/+4
|
* Made StorageErrors directly convertible into Micropub JSON responsesVika2021-05-041-0/+16
|
* Fixed Redis testsVika2021-05-041-3/+5
|
* Implemented MemoryStorage::update_post()Vika2021-05-041-0/+2
|
* Refactored the database module and its testsVika2021-05-041-0/+263