reactive_graph_plugin_api/
plugin_state.rs

1/// A plugin has one of these lifecycle states.
2#[derive(Debug, Copy, Clone, Eq, PartialEq)]
3pub enum PluginState {
4    /// The runtime knows the plugin is there.
5    Installed,
6
7    /// The state of the plugin is not yet complete
8    Resolving(PluginResolveState),
9
10    /// The plugin is there and all it’s prerequisites (dependencies) are available. The plugin can be started (or has been stopped).
11    Resolved,
12
13    /// The plugin is being started. If it has a init method, it is executed. When done, the plugin will become "Active".
14    Starting(PluginStartingState),
15
16    /// The plugin is running.
17    Active,
18
19    /// The plugin is being stopped. If it has a shutdown method, it is executed. When done, the plugin will become "Resolved".
20    Stopping(PluginStoppingState),
21
22    /// The plugin is being uninstalled.
23    Uninstalling(PluginUninstallingState),
24
25    /// The plugin is being refreshed.
26    Refreshing(PluginRefreshingState),
27
28    /// The plugin has been removed from the runtime.
29    Uninstalled,
30
31    /// The plugin has been disabled.
32    Disabled,
33}
34
35#[derive(Debug, Copy, Clone, Eq, PartialEq)]
36pub enum PluginResolveState {
37    /// The runtime has loaded the dynamic link library.
38    Loaded,
39
40    /// The runtime has loaded the plugin declaration.
41    PluginDeclarationLoaded,
42
43    /// The plugin was compiled with an incompatible version of rustc.
44    CompilerVersionMismatch,
45
46    /// The plugin was compiled with an incompatible version of the plugin api.
47    PluginApiVersionMismatch,
48
49    /// The plugin is compatible.
50    PluginCompatible,
51
52    /// At least of of the dependencies are not active.
53    DependenciesNotActive,
54}
55
56#[derive(Debug, Copy, Clone, Eq, PartialEq)]
57pub enum PluginStartingState {
58    /// The plugin proxy is being constructed.
59    ConstructingProxy,
60
61    /// The providers of the plugin are being registered.
62    Registering,
63
64    /// The plugin is being activated.
65    Activating,
66
67    /// The plugin failed to activate.
68    ActivationFailed,
69}
70
71#[derive(Debug, Copy, Clone, Eq, PartialEq)]
72pub enum PluginStoppingState {
73    /// The plugin is being deactivated.
74    Deactivating,
75
76    /// The providers of the plugin are being unregistered.
77    Unregistering,
78
79    /// The plugin proxy is being destructed.
80    RemoveProxy,
81}
82
83#[derive(Debug, Copy, Clone, Eq, PartialEq)]
84pub enum PluginUninstallingState {
85    /// The DLL is being unloaded from memory.
86    UnloadDll,
87
88    /// The DLL is being deleted from file system.
89    UninstallDll,
90}
91
92#[derive(Debug, Copy, Clone, Eq, PartialEq)]
93pub enum PluginRefreshingState {
94    /// The plugin is being stopped.
95    Stopping(PluginStoppingState),
96
97    /// The plugin is being uninstalled.
98    Uninstalling(PluginUninstallingState),
99
100    /// The plugin is being deployed.
101    Deploying,
102
103    /// The plugin is installed.
104    Installed,
105
106    /// The plugin is being resolved.
107    Resolving(PluginResolveState),
108
109    /// The plugin is being started.
110    Starting(PluginStartingState),
111}
112
113#[derive(Debug)]
114pub enum PluginUnloadingError {
115    UnloadingFailed,
116}
117
118#[derive(Debug)]
119pub enum PluginStartError {
120    AlreadyActive,
121    InTransition,
122    NotResolved(PluginState),
123    Uninstalled,
124}
125
126#[derive(Debug)]
127pub enum PluginStopError {
128    NotActive,
129    InTransition,
130    Uninstalled,
131}
132
133#[derive(Debug)]
134pub enum PluginUninstallError {
135    AlreadyUninstalled,
136    NotStopped,
137    InTransition,
138    Uninstalled,
139    Disabled,
140}
141
142#[derive(Debug)]
143pub enum PluginDeployError {
144    InTransition,
145    Uninstalled,
146    Disabled,
147    NotFound,
148}
149
150#[derive(Debug)]
151pub enum PluginDisableError {
152    NotFound,
153}