refactor: remove connection storage from plugin structs and pass as argument
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -60,10 +60,10 @@ pub trait MetaPlugin {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()>;
|
fn finalize(&mut self, conn: &Connection) -> Result<()>;
|
||||||
|
|
||||||
// Update the meta plugin with new data
|
// Update the meta plugin with new data
|
||||||
fn update(&mut self, data: &[u8]);
|
fn update(&mut self, data: &[u8], conn: &Connection);
|
||||||
|
|
||||||
fn meta_name(&mut self) -> String;
|
fn meta_name(&mut self) -> String;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ pub struct DigestSha256MetaPlugin {
|
|||||||
hasher: Sha256,
|
hasher: Sha256,
|
||||||
meta_name: String,
|
meta_name: String,
|
||||||
item_id: Option<i64>,
|
item_id: Option<i64>,
|
||||||
conn: Option<*mut Connection>,
|
|
||||||
output_names: std::collections::HashMap<String, String>,
|
output_names: std::collections::HashMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,7 +19,6 @@ impl DigestSha256MetaPlugin {
|
|||||||
hasher: Sha256::new(),
|
hasher: Sha256::new(),
|
||||||
meta_name: "digest_sha256".to_string(),
|
meta_name: "digest_sha256".to_string(),
|
||||||
item_id: None,
|
item_id: None,
|
||||||
conn: None,
|
|
||||||
output_names: std::collections::HashMap::new(),
|
output_names: std::collections::HashMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,29 +29,24 @@ impl MetaPlugin for DigestSha256MetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn initialize(&mut self, conn: &Connection, item_id: i64) -> Result<()> {
|
fn initialize(&mut self, _conn: &Connection, item_id: i64) -> Result<()> {
|
||||||
self.item_id = Some(item_id);
|
self.item_id = Some(item_id);
|
||||||
// Store raw pointer to connection - unsafe but necessary for this design
|
|
||||||
self.conn = Some(conn as *const _ as *mut Connection);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, conn: &Connection) -> Result<()> {
|
||||||
if let (Some(conn), Some(item_id)) = (self.conn, self.item_id) {
|
if let Some(item_id) = self.item_id {
|
||||||
// Convert raw pointer back to reference (unsafe)
|
|
||||||
let conn_ref = unsafe { &*conn };
|
|
||||||
|
|
||||||
// Finalize the hash
|
// Finalize the hash
|
||||||
let hash_result = self.hasher.finalize_reset();
|
let hash_result = self.hasher.finalize_reset();
|
||||||
let hex_string = format!("{:x}", hash_result);
|
let hex_string = format!("{:x}", hash_result);
|
||||||
|
|
||||||
// Save the hash as metadata using central output handler
|
// Save the hash as metadata using central output handler
|
||||||
let _ = output_metadata(conn_ref, item_id, &self.meta_name, hex_string, &self.output_names);
|
let _ = output_metadata(conn, item_id, &self.meta_name, hex_string, &self.output_names);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, data: &[u8]) {
|
fn update(&mut self, data: &[u8], _conn: &Connection) {
|
||||||
self.hasher.update(data);
|
self.hasher.update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,11 +93,11 @@ impl MetaPlugin for ReadTimeMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
if self.start_time.is_none() {
|
if self.start_time.is_none() {
|
||||||
self.start_time = Some(Instant::now());
|
self.start_time = Some(Instant::now());
|
||||||
}
|
}
|
||||||
@@ -137,11 +130,11 @@ impl MetaPlugin for ReadRateMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, data: &[u8]) {
|
fn update(&mut self, data: &[u8], _conn: &Connection) {
|
||||||
if self.start_time.is_none() {
|
if self.start_time.is_none() {
|
||||||
self.start_time = Some(Instant::now());
|
self.start_time = Some(Instant::now());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ pub struct MagicFileMetaPlugin {
|
|||||||
max_buffer_size: usize,
|
max_buffer_size: usize,
|
||||||
is_saved: bool,
|
is_saved: bool,
|
||||||
item_id: Option<i64>,
|
item_id: Option<i64>,
|
||||||
conn: Option<*mut Connection>,
|
|
||||||
cookie: Option<Cookie>,
|
cookie: Option<Cookie>,
|
||||||
output_names: std::collections::HashMap<String, String>,
|
output_names: std::collections::HashMap<String, String>,
|
||||||
}
|
}
|
||||||
@@ -23,7 +22,6 @@ impl MagicFileMetaPlugin {
|
|||||||
max_buffer_size: 4096, // Same as BinaryMetaPlugin
|
max_buffer_size: 4096, // Same as BinaryMetaPlugin
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
item_id: None,
|
item_id: None,
|
||||||
conn: None,
|
|
||||||
cookie: None,
|
cookie: None,
|
||||||
output_names: std::collections::HashMap::new(),
|
output_names: std::collections::HashMap::new(),
|
||||||
}
|
}
|
||||||
@@ -56,15 +54,12 @@ impl MagicFileMetaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn save_all_magic_metadata(&mut self) -> Result<()> {
|
fn save_all_magic_metadata(&mut self, conn: &Connection) -> Result<()> {
|
||||||
if let (Some(conn), Some(item_id)) = (self.conn, self.item_id) {
|
if let Some(item_id) = self.item_id {
|
||||||
// Convert raw pointer back to reference (unsafe)
|
|
||||||
let conn_ref = unsafe { &*conn };
|
|
||||||
|
|
||||||
// Only save MIME type since that's what's mapped in the config
|
// Only save MIME type since that's what's mapped in the config
|
||||||
if let Ok(mime_type) = self.get_magic_result(CookieFlags::MIME_TYPE) {
|
if let Ok(mime_type) = self.get_magic_result(CookieFlags::MIME_TYPE) {
|
||||||
if !mime_type.is_empty() {
|
if !mime_type.is_empty() {
|
||||||
let _ = output_metadata(conn_ref, item_id, "mime_type", mime_type, &self.output_names);
|
let _ = output_metadata(conn, item_id, "mime_type", mime_type, &self.output_names);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,10 +74,8 @@ impl MetaPlugin for MagicFileMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn initialize(&mut self, conn: &Connection, item_id: i64) -> Result<()> {
|
fn initialize(&mut self, _conn: &Connection, item_id: i64) -> Result<()> {
|
||||||
self.item_id = Some(item_id);
|
self.item_id = Some(item_id);
|
||||||
// Store raw pointer to connection - unsafe but necessary for this design
|
|
||||||
self.conn = Some(conn as *const _ as *mut Connection);
|
|
||||||
|
|
||||||
// Initialize the magic cookie once
|
// Initialize the magic cookie once
|
||||||
let cookie = Cookie::open(Default::default())
|
let cookie = Cookie::open(Default::default())
|
||||||
@@ -94,17 +87,17 @@ impl MetaPlugin for MagicFileMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, conn: &Connection) -> Result<()> {
|
||||||
// Save all magic metadata if not already saved
|
// Save all magic metadata if not already saved
|
||||||
if !self.is_saved {
|
if !self.is_saved {
|
||||||
if let Err(e) = self.save_all_magic_metadata() {
|
if let Err(e) = self.save_all_magic_metadata(conn) {
|
||||||
eprintln!("Warning: Failed to save magic metadata: {}", e);
|
eprintln!("Warning: Failed to save magic metadata: {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, data: &[u8]) {
|
fn update(&mut self, data: &[u8], conn: &Connection) {
|
||||||
// Only collect up to max_buffer_size
|
// Only collect up to max_buffer_size
|
||||||
let remaining_capacity = self.max_buffer_size.saturating_sub(self.buffer.len());
|
let remaining_capacity = self.max_buffer_size.saturating_sub(self.buffer.len());
|
||||||
if remaining_capacity > 0 {
|
if remaining_capacity > 0 {
|
||||||
@@ -113,7 +106,7 @@ impl MetaPlugin for MagicFileMetaPlugin {
|
|||||||
|
|
||||||
// Check if we've reached our buffer limit and save if so
|
// Check if we've reached our buffer limit and save if so
|
||||||
if self.buffer.len() >= self.max_buffer_size && !self.is_saved {
|
if self.buffer.len() >= self.max_buffer_size && !self.is_saved {
|
||||||
if let Err(e) = self.save_all_magic_metadata() {
|
if let Err(e) = self.save_all_magic_metadata(conn) {
|
||||||
eprintln!("Warning: Failed to save magic metadata early: {}", e);
|
eprintln!("Warning: Failed to save magic metadata early: {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ pub struct MetaPluginProgram {
|
|||||||
process: Option<Child>,
|
process: Option<Child>,
|
||||||
writer: Option<Box<dyn Write>>,
|
writer: Option<Box<dyn Write>>,
|
||||||
item_id: Option<i64>,
|
item_id: Option<i64>,
|
||||||
conn: Option<*mut Connection>,
|
|
||||||
result: Option<String>,
|
result: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +47,6 @@ impl MetaPluginProgram {
|
|||||||
process: None,
|
process: None,
|
||||||
writer: None,
|
writer: None,
|
||||||
item_id: None,
|
item_id: None,
|
||||||
conn: None,
|
|
||||||
result: None,
|
result: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,12 +61,11 @@ impl MetaPlugin for MetaPluginProgram {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn initialize(&mut self, conn: &rusqlite::Connection, item_id: i64) -> Result<()> {
|
fn initialize(&mut self, _conn: &rusqlite::Connection, item_id: i64) -> Result<()> {
|
||||||
debug!("META: Initializing program plugin: {:?}", self);
|
debug!("META: Initializing program plugin: {:?}", self);
|
||||||
|
|
||||||
// Store database connection and item ID for later use
|
// Store item ID for later use
|
||||||
self.item_id = Some(item_id);
|
self.item_id = Some(item_id);
|
||||||
self.conn = Some(conn as *const _ as *mut Connection);
|
|
||||||
|
|
||||||
let program = self.program.clone();
|
let program = self.program.clone();
|
||||||
let args = self.args.clone();
|
let args = self.args.clone();
|
||||||
@@ -94,7 +91,7 @@ impl MetaPlugin for MetaPluginProgram {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, conn: &Connection) -> Result<()> {
|
||||||
debug!("META: Finalizing program plugin");
|
debug!("META: Finalizing program plugin");
|
||||||
if let Some(process) = self.process.take() {
|
if let Some(process) = self.process.take() {
|
||||||
// Close stdin to signal end of input
|
// Close stdin to signal end of input
|
||||||
@@ -116,16 +113,14 @@ impl MetaPlugin for MetaPluginProgram {
|
|||||||
debug!("META: Program output: {}", result);
|
debug!("META: Program output: {}", result);
|
||||||
self.result = Some(result);
|
self.result = Some(result);
|
||||||
|
|
||||||
// Save the result to database if we have connection and item_id
|
// Save the result to database if we have item_id
|
||||||
if let (Some(conn), Some(item_id)) = (self.conn, self.item_id) {
|
if let Some(item_id) = self.item_id {
|
||||||
// Convert raw pointer back to reference (unsafe)
|
|
||||||
let conn_ref = unsafe { &*conn };
|
|
||||||
let meta = crate::db::Meta {
|
let meta = crate::db::Meta {
|
||||||
id: item_id,
|
id: item_id,
|
||||||
name: self.meta_name.clone(),
|
name: self.meta_name.clone(),
|
||||||
value: self.result.clone().unwrap(),
|
value: self.result.clone().unwrap(),
|
||||||
};
|
};
|
||||||
let _ = crate::db::store_meta(conn_ref, meta);
|
let _ = crate::db::store_meta(conn, meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -139,7 +134,7 @@ impl MetaPlugin for MetaPluginProgram {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, data: &[u8]) {
|
fn update(&mut self, data: &[u8], _conn: &Connection) {
|
||||||
if let Some(ref mut writer) = self.writer {
|
if let Some(ref mut writer) = self.writer {
|
||||||
if let Err(e) = writer.write_all(data) {
|
if let Err(e) = writer.write_all(data) {
|
||||||
debug!("META: Failed to write to process stdin: {}", e);
|
debug!("META: Failed to write to process stdin: {}", e);
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ pub struct BinaryMetaPlugin {
|
|||||||
max_buffer_size: usize,
|
max_buffer_size: usize,
|
||||||
is_saved: bool,
|
is_saved: bool,
|
||||||
item_id: Option<i64>,
|
item_id: Option<i64>,
|
||||||
conn: Option<*mut Connection>,
|
|
||||||
output_names: std::collections::HashMap<String, String>,
|
output_names: std::collections::HashMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +35,6 @@ impl BinaryMetaPlugin {
|
|||||||
max_buffer_size: 4096, // 4KB
|
max_buffer_size: 4096, // 4KB
|
||||||
is_saved: false,
|
is_saved: false,
|
||||||
item_id: None,
|
item_id: None,
|
||||||
conn: None,
|
|
||||||
output_names: std::collections::HashMap::new(),
|
output_names: std::collections::HashMap::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,17 +46,15 @@ impl MetaPlugin for BinaryMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, conn: &Connection) -> Result<()> {
|
||||||
// Save the binary detection result when finalizing, after all data has been collected
|
// Save the binary detection result when finalizing, after all data has been collected
|
||||||
if !self.is_saved {
|
if !self.is_saved {
|
||||||
if let (Some(conn), Some(item_id)) = (self.conn, self.item_id) {
|
if let Some(item_id) = self.item_id {
|
||||||
// Convert raw pointer back to reference (unsafe)
|
|
||||||
let conn_ref = unsafe { &*conn };
|
|
||||||
let is_binary = is_binary(&self.buffer);
|
let is_binary = is_binary(&self.buffer);
|
||||||
let value = if is_binary { "true".to_string() } else { "false".to_string() };
|
let value = if is_binary { "true".to_string() } else { "false".to_string() };
|
||||||
|
|
||||||
// Save to database immediately using central output handler
|
// Save to database immediately using central output handler
|
||||||
let _ = output_metadata(conn_ref, item_id, &self.meta_name, value, &self.output_names);
|
let _ = output_metadata(conn, item_id, &self.meta_name, value, &self.output_names);
|
||||||
|
|
||||||
self.is_saved = true;
|
self.is_saved = true;
|
||||||
}
|
}
|
||||||
@@ -66,7 +62,7 @@ impl MetaPlugin for BinaryMetaPlugin {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, data: &[u8]) {
|
fn update(&mut self, data: &[u8], _conn: &Connection) {
|
||||||
// Only collect up to max_buffer_size
|
// Only collect up to max_buffer_size
|
||||||
let remaining_capacity = self.max_buffer_size.saturating_sub(self.buffer.len());
|
let remaining_capacity = self.max_buffer_size.saturating_sub(self.buffer.len());
|
||||||
if remaining_capacity > 0 {
|
if remaining_capacity > 0 {
|
||||||
@@ -79,10 +75,8 @@ impl MetaPlugin for BinaryMetaPlugin {
|
|||||||
self.meta_name.clone()
|
self.meta_name.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn initialize(&mut self, conn: &Connection, item_id: i64) -> Result<()> {
|
fn initialize(&mut self, _conn: &Connection, item_id: i64) -> Result<()> {
|
||||||
self.item_id = Some(item_id);
|
self.item_id = Some(item_id);
|
||||||
// Store raw pointer to connection - unsafe but necessary for this design
|
|
||||||
self.conn = Some(conn as *const _ as *mut Connection);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,12 +119,12 @@ impl MetaPlugin for CwdMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
// No update needed
|
// No update needed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,12 +181,12 @@ impl MetaPlugin for UidMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
// No update needed
|
// No update needed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,12 +222,12 @@ impl MetaPlugin for UserMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
// No update needed
|
// No update needed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,12 +266,12 @@ impl MetaPlugin for GidMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
// No update needed
|
// No update needed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,12 +307,12 @@ impl MetaPlugin for GroupMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
// No update needed
|
// No update needed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,12 +351,12 @@ impl MetaPlugin for ShellMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
// No update needed
|
// No update needed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,12 +395,12 @@ impl MetaPlugin for ShellPidMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
// No update needed
|
// No update needed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,12 +439,12 @@ impl MetaPlugin for KeepPidMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
// No update needed
|
// No update needed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,12 +480,12 @@ impl MetaPlugin for HostnameMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
// No update needed for hostname
|
// No update needed for hostname
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,12 +524,12 @@ impl MetaPlugin for FullHostnameMetaPlugin {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize(&mut self) -> Result<()> {
|
fn finalize(&mut self, _conn: &Connection) -> Result<()> {
|
||||||
// Since we save during initialize(), return Ok to avoid duplicate saves
|
// Since we save during initialize(), return Ok to avoid duplicate saves
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, _data: &[u8], _conn: &Connection) {
|
||||||
// No update needed for full hostname
|
// No update needed for full hostname
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user