pub struct Index {
pub index_schema_version: IndexSchemaVersion,
pub artifacts_url: ArtifactsUrl,
pub plugins: Vec<IndexEntry>,
}Expand description
A parsed plugin registry index.
Fields§
§index_schema_version: IndexSchemaVersion§artifacts_url: ArtifactsUrl§plugins: Vec<IndexEntry>Implementations§
Source§impl Index
impl Index
Sourcepub fn parse_json(input: &str) -> Result<Index, SchemaErrors>
pub fn parse_json(input: &str) -> Result<Index, SchemaErrors>
Parses an index from JSON, collecting every field-level defect from
every entry in one pass (including duplicate (name, version) pairs).
Syntax errors and an unsupported/malformed index_schema_version
short-circuit with a single error.
§Examples
use influxdb3_plugin_schemas::Index;
let source = r#"{
"index_schema_version": "2.0",
"artifacts_url": "https://plugins.example.com/artifacts",
"plugins": []
}"#;
let index = Index::parse_json(source).unwrap();
assert!(index.plugins.is_empty());Sourcepub fn to_canonical_json(&self) -> Result<String, SchemaError>
pub fn to_canonical_json(&self) -> Result<String, SchemaError>
Serializes this index to its canonical JSON form:
- Field ordering matches struct declaration order.
plugins[]sorted bynameascending, thenversionascending by SemVer precedence. Metadata fields such aspublished_atand yank status do not affect ordering.- 2-space indent, pretty-printed, trailing newline.
- NFC Unicode normalization on free-text
descriptionfields. Other string fields are already ASCII-constrained by their validators; URL fields normalize viaurl::Urlparse.
Sourcepub fn check_entry_insert(
&self,
entry: &IndexEntry,
) -> Result<(), IndexInsertError>
pub fn check_entry_insert( &self, entry: &IndexEntry, ) -> Result<(), IndexInsertError>
Checks whether entry can be inserted into this index without
violating uniqueness or canonical-collision invariants.
Returns Ok(()) when the insert would be safe, or an
crate::IndexInsertError describing the conflict.
This method does not modify the index.
Sourcepub fn push_entry(&mut self, entry: IndexEntry) -> Result<(), IndexInsertError>
pub fn push_entry(&mut self, entry: IndexEntry) -> Result<(), IndexInsertError>
Validates entry against the current index and, if valid, appends it
to self.plugins.
Returns Err without modifying the index when the entry would create a
duplicate (name, version) pair or a canonical-name collision.
Source§impl Index
impl Index
pub fn search(&self, query: &IndexSearchQuery) -> IndexSearchResult
pub fn info(&self, query: &IndexInfoQuery) -> IndexInfoResult
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Index
impl<'de> Deserialize<'de> for Index
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Index, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Index, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Index
impl Serialize for Index
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Index
Auto Trait Implementations§
impl Freeze for Index
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnsafeUnpin for Index
impl UnwindSafe for Index
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more