docs: Add comprehensive rustdoc to item_service.rs
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -406,6 +406,36 @@ impl ItemService {
|
|||||||
Ok(item_id)
|
Ok(item_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Saves pre-loaded content as a new item, typically from MCP (Machine-Common-Processing) sources.
|
||||||
|
///
|
||||||
|
/// Bypasses streaming read, directly writes content and applies metadata/plugins.
|
||||||
|
///
|
||||||
|
/// # Arguments
|
||||||
|
///
|
||||||
|
/// * `content` - Byte slice of content to save.
|
||||||
|
/// * `tags` - Tags to associate.
|
||||||
|
/// * `metadata` - Initial metadata key-value pairs.
|
||||||
|
/// * `cmd` - Mutable command.
|
||||||
|
/// * `settings` - Settings.
|
||||||
|
/// * `conn` - Mutable database connection.
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
///
|
||||||
|
/// * `Result<ItemWithMeta, CoreError>` - The saved item with full details.
|
||||||
|
///
|
||||||
|
/// # Errors
|
||||||
|
///
|
||||||
|
/// * `CoreError::Database(...)` - If DB insert fails.
|
||||||
|
/// * `CoreError::Io(...)` - If file write fails.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// let content = b"Hello, world!";
|
||||||
|
/// let tags = vec!["mcp".to_string()];
|
||||||
|
/// let meta = HashMap::from([("source".to_string(), "api".to_string())]);
|
||||||
|
/// let item = service.save_item_from_mcp(content, &tags, &meta, &mut cmd, &settings, &mut conn)?;
|
||||||
|
/// ```
|
||||||
pub fn save_item_from_mcp(
|
pub fn save_item_from_mcp(
|
||||||
&self,
|
&self,
|
||||||
content: &[u8],
|
content: &[u8],
|
||||||
@@ -465,10 +495,20 @@ impl ItemService {
|
|||||||
self.get_item(conn, item_id)
|
self.get_item(conn, item_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a reference to the internal compression service.
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
///
|
||||||
|
/// Reference to `CompressionService`.
|
||||||
pub fn get_compression_service(&self) -> &CompressionService {
|
pub fn get_compression_service(&self) -> &CompressionService {
|
||||||
&self.compression_service
|
&self.compression_service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a reference to the data directory path.
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
///
|
||||||
|
/// Reference to `PathBuf`.
|
||||||
pub fn get_data_path(&self) -> &PathBuf {
|
pub fn get_data_path(&self) -> &PathBuf {
|
||||||
&self.data_path
|
&self.data_path
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user