fidius_host/types.rs
1// Copyright 2026 Colliery, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Owned metadata types for loaded plugins.
16
17use fidius_core::descriptor::{BufferStrategyKind, WireFormat};
18
19/// Owned metadata for a discovered or loaded plugin.
20///
21/// All data copied from FFI descriptor — no raw pointers.
22#[derive(Debug, Clone)]
23pub struct PluginInfo {
24 /// Human-readable plugin name (e.g., "BlurFilter").
25 pub name: String,
26 /// Interface trait name (e.g., "ImageFilter").
27 pub interface_name: String,
28 /// FNV-1a hash of required method signatures.
29 pub interface_hash: u64,
30 /// User-specified interface version.
31 pub interface_version: u32,
32 /// Capability bitfield (optional method support).
33 pub capabilities: u64,
34 /// Wire serialization format.
35 pub wire_format: WireFormat,
36 /// Buffer management strategy.
37 pub buffer_strategy: BufferStrategyKind,
38}
39
40/// Controls how strictly the host validates plugins.
41#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
42pub enum LoadPolicy {
43 /// Reject any validation failure, require signatures if configured.
44 #[default]
45 Strict,
46 /// Warn on unsigned plugins but allow loading.
47 Lenient,
48}