Rename plugin cache file ⇒ plugin registry file (#12634)

# Description
So far this seems like the winner of my poll on what the name should be.
I'll take this off draft once the poll expires, if this is indeed the
winner.
This commit is contained in:
Devyn Cairns
2024-04-24 15:40:39 -07:00
committed by GitHub
parent 9996e4a1f8
commit 25cbcb511d
22 changed files with 165 additions and 159 deletions

View File

@@ -24,7 +24,7 @@ use std::{
type PoisonDebuggerError<'a> = PoisonError<MutexGuard<'a, Box<dyn Debugger>>>;
#[cfg(feature = "plugin")]
use crate::{PluginCacheFile, PluginCacheItem, RegisteredPlugin};
use crate::{PluginRegistryFile, PluginRegistryItem, RegisteredPlugin};
pub static PWD_ENV: &str = "PWD";
@@ -267,10 +267,10 @@ impl EngineState {
}
#[cfg(feature = "plugin")]
if !delta.plugin_cache_items.is_empty() {
if !delta.plugin_registry_items.is_empty() {
// Update the plugin file with the new signatures.
if self.plugin_path.is_some() {
self.update_plugin_file(std::mem::take(&mut delta.plugin_cache_items))?;
self.update_plugin_file(std::mem::take(&mut delta.plugin_registry_items))?;
}
}
@@ -482,7 +482,7 @@ impl EngineState {
#[cfg(feature = "plugin")]
pub fn update_plugin_file(
&self,
updated_items: Vec<PluginCacheItem>,
updated_items: Vec<PluginRegistryItem>,
) -> Result<(), ShellError> {
// Updating the signatures plugin file with the added signatures
use std::fs::File;
@@ -500,10 +500,10 @@ impl EngineState {
// Read the current contents of the plugin file if it exists
let mut contents = match File::open(plugin_path.as_path()) {
Ok(mut plugin_file) => PluginCacheFile::read_from(&mut plugin_file, None),
Ok(mut plugin_file) => PluginRegistryFile::read_from(&mut plugin_file, None),
Err(err) => {
if err.kind() == std::io::ErrorKind::NotFound {
Ok(PluginCacheFile::default())
Ok(PluginRegistryFile::default())
} else {
Err(ShellError::GenericError {
error: "Failed to open plugin file".into(),

View File

@@ -9,7 +9,7 @@ use crate::{
use std::sync::Arc;
#[cfg(feature = "plugin")]
use crate::{PluginCacheItem, RegisteredPlugin};
use crate::{PluginRegistryItem, RegisteredPlugin};
/// A delta (or change set) between the current global state and a possible future global state. Deltas
/// can be applied to the global state to update it to contain both previous state and the state held
@@ -26,7 +26,7 @@ pub struct StateDelta {
#[cfg(feature = "plugin")]
pub(super) plugins: Vec<Arc<dyn RegisteredPlugin>>,
#[cfg(feature = "plugin")]
pub(super) plugin_cache_items: Vec<PluginCacheItem>,
pub(super) plugin_registry_items: Vec<PluginRegistryItem>,
}
impl StateDelta {
@@ -50,7 +50,7 @@ impl StateDelta {
#[cfg(feature = "plugin")]
plugins: vec![],
#[cfg(feature = "plugin")]
plugin_cache_items: vec![],
plugin_registry_items: vec![],
}
}

View File

@@ -15,7 +15,7 @@ use std::{
};
#[cfg(feature = "plugin")]
use crate::{PluginCacheItem, PluginIdentity, RegisteredPlugin};
use crate::{PluginIdentity, PluginRegistryItem, RegisteredPlugin};
/// A temporary extension to the global state. This handles bridging between the global state and the
/// additional declarations and scope changes that are not yet part of the global scope.
@@ -182,8 +182,8 @@ impl<'a> StateWorkingSet<'a> {
}
#[cfg(feature = "plugin")]
pub fn update_plugin_cache(&mut self, item: PluginCacheItem) {
self.delta.plugin_cache_items.push(item);
pub fn update_plugin_registry(&mut self, item: PluginRegistryItem) {
self.delta.plugin_registry_items.push(item);
}
pub fn merge_predecl(&mut self, name: &[u8]) -> Option<DeclId> {