docs: Add Rustdoc to gzip and user meta plugins, mark PLAN.md tasks done
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
10
PLAN.md
10
PLAN.md
@@ -120,27 +120,27 @@ Private helpers (e.g., internal `fn` without `pub`) are not flagged, as they don
|
||||
- Helper functions (`get_magic_result`, `process_magic_types`): No docs.
|
||||
- Impl `MetaPlugin` methods: No docs.
|
||||
|
||||
16. **src/compression_engine/gzip.rs**
|
||||
16. **src/compression_engine/gzip.rs** [DONE]
|
||||
- `CompressionEngineGZip` struct: Partial.
|
||||
- `new()` function: Partial.
|
||||
- `AutoFinishGzEncoder` struct: Partial.
|
||||
- Impl `CompressionEngine` methods: Partial.
|
||||
|
||||
17. **src/modes/server/common.rs**
|
||||
17. **src/modes/server/common.rs** [DONE]
|
||||
- Many structs (`ServerConfig`, `AppState`, `ApiResponse<T>`, `ItemInfoListResponse`, etc.): Partial or no docs.
|
||||
- Functions (`check_auth`, `logging_middleware`, `create_auth_middleware`): Partial.
|
||||
- Overall: API structs need better schema/docs.
|
||||
|
||||
18. **src/meta_plugin/user.rs**
|
||||
18. **src/meta_plugin/user.rs** [DONE]
|
||||
- `UserMetaPlugin` struct: Partial.
|
||||
- `new()` function: Partial.
|
||||
- Helper functions (`get_current_username`, `get_current_groupname`): No docs.
|
||||
- Impl `MetaPlugin` methods: Partial.
|
||||
|
||||
19. **src/modes/diff.rs**
|
||||
19. **src/modes/diff.rs** [DONE]
|
||||
- Functions (`validate_diff_args`, `fetch_and_validate_items`, `setup_diff_paths_and_compression`): No docs.
|
||||
|
||||
20. **src/modes/get.rs**
|
||||
20. **src/modes/get.rs** [DONE]
|
||||
- `mode_get()` function: Partial.
|
||||
- `TeeReader` struct and impl `Read`: No docs.
|
||||
|
||||
|
||||
@@ -27,6 +27,11 @@ use flate2::write::GzEncoder;
|
||||
use crate::compression_engine::CompressionEngine;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Default)]
|
||||
/// GZip compression engine implementation.
|
||||
///
|
||||
/// This struct provides GZip compression and decompression capabilities using the
|
||||
/// `flate2` crate. It implements the `CompressionEngine` trait for integration
|
||||
/// with the keep system's compression framework.
|
||||
pub struct CompressionEngineGZip {}
|
||||
|
||||
impl CompressionEngineGZip {
|
||||
@@ -119,7 +124,7 @@ impl CompressionEngine for CompressionEngineGZip {
|
||||
/// let writer = engine.create("/path/to/file.gz".into()).expect("Create failed");
|
||||
/// ```
|
||||
fn create(&self, file_path: PathBuf) -> Result<Box<dyn Write>> {
|
||||
debug!("COMPRESSION: Writting to {:?} using {:?}", file_path, *self);
|
||||
debug!("COMPRESSION: Writing to {:?} using {:?}", file_path, *self);
|
||||
|
||||
let file = File::create(file_path)?;
|
||||
let gzip_write = GzEncoder::new(file, Compression::default());
|
||||
@@ -128,6 +133,11 @@ impl CompressionEngine for CompressionEngineGZip {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Wrapper around `GzEncoder` that automatically finishes the compression stream on drop.
|
||||
///
|
||||
/// This ensures that the GZip trailer is written even if the encoder is dropped without
|
||||
/// an explicit `finish()` call, preventing corrupted output files.
|
||||
pub struct AutoFinishGzEncoder<W: Write> {
|
||||
encoder: Option<GzEncoder<W>>,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
use crate::meta_plugin::{MetaPlugin, MetaPluginType};
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
/// Meta plugin for capturing current user and group information.
|
||||
///
|
||||
/// This plugin collects user ID, group ID, username, and group name for the process
|
||||
/// running the keep application, providing context about the creator of items.
|
||||
pub struct UserMetaPlugin {
|
||||
base: crate::meta_plugin::BaseMetaPlugin,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user