Struct tikv::coprocessor_v2::plugin_registry::PluginRegistry [−][src]
Manages loading and unloading of coprocessor plugins.
Fields
inner: Arc<RwLock<PluginRegistryInner>>
fs_watcher: Option<RecommendedWatcher>
Active file system watcher for hot-reloading. If dropped, the corresponding hot-reloading thread will stop.
Implementations
impl PluginRegistry
[src]
pub fn new() -> Self
[src]
Creates a new PluginRegistry
.
pub fn start_hot_reloading(
&mut self,
plugin_directory: impl Into<PathBuf>
) -> Result<()>
[src]
&mut self,
plugin_directory: impl Into<PathBuf>
) -> Result<()>
Hot-reloads plugins from a given directory.
All plugins that are already present in the directory will be loaded. A background thread is spawned to watch file system events. If the library file of a loaded plugin is deleted, the corresponding plugin is automatically unloaded; if a new library file is placed into the directory, it will be automatically loaded into TiKV’s coprocessor plugin system.
A file will only be loaded if it has the proper file ending of dynamic link libraries for
the current platform (.so
for Linux, .dylib
for MacOS, .dll
for Windows).
pub fn get_plugin(&self, plugin_name: &str) -> Option<Arc<LoadedPlugin>>
[src]
Finds a plugin by its name. The plugin must have been loaded before with [load_plugin()
].
Plugins are indexed by the name that is returned by [CoprocessorPlugin::name()
].
pub fn get_plugin_by_path<P: AsRef<OsStr>>(
&self,
plugin_path: P
) -> Option<Arc<LoadedPlugin>>
[src]
&self,
plugin_path: P
) -> Option<Arc<LoadedPlugin>>
finds a plugin by its associated file path, similar to [get_plugin()
].
The given path has to be exactly the same as the one the plugin with loaded with, e.g.
"./coprocessors/plugin1.so"
would be different from "coprocessors/plugin1.so"
(note the leading ./
). The same applies when the associated path was changed with
[update_plugin_path()
].
pub fn loaded_plugin_names(&self) -> Vec<String>
[src]
Returns the names of the currently loaded plugins. The order of plugin names is arbitrary.
pub fn load_plugin<P: AsRef<OsStr>>(
&self,
file_name: P
) -> Result<String, PluginLoadingError>
[src]
&self,
file_name: P
) -> Result<String, PluginLoadingError>
Loads a CoprocessorPlugin
from a dylib
.
After this function has successfully finished, the plugin is registered with the
PluginRegistry
and can later be obtained by calling [get_plugin()
] with the proper
name.
Returns the name of the loaded plugin.
pub fn load_plugins_from_dir(
&self,
dir_name: impl Into<PathBuf>
) -> Result<Vec<String>>
[src]
&self,
dir_name: impl Into<PathBuf>
) -> Result<Vec<String>>
Attempts to load all plugins from a given directory.
Returns a list of the names of all successfully loaded plugins. If a file could not be successfully loaded as a plugin, it will be discarded.
The plugins have to follow the system’s naming convention in order to be loaded, e.g. .so
for Linux, .dylib
for MacOS and .dll
for Windows.
pub fn unload_plugin(&self, plugin_name: &str)
[src]
Unloads a plugin with the given plugin_name
.
pub fn update_plugin_path<P: AsRef<OsStr>>(
&self,
plugin_name: &str,
new_path: P
)
[src]
&self,
plugin_name: &str,
new_path: P
)
Updates the associated file path for plugin.
This function should be used to maintain consistent state when the underlying file of a plugin was renamed or moved.
pub fn get_path_for_plugin(&self, plugin_name: &str) -> Option<OsString>
[src]
Returns the associated file path for the plugin for the given plugin_name
.
Auto Trait Implementations
impl RefUnwindSafe for PluginRegistry
impl Send for PluginRegistry
impl Sync for PluginRegistry
impl Unpin for PluginRegistry
impl UnwindSafe for PluginRegistry
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<V, W> ConvertFrom<W> for V where
W: ConvertTo<V>,
[src]
W: ConvertTo<V>,
pub fn convert_from(ctx: &mut EvalContext, from: W) -> Result<V, Error>
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,