pub trait IndexDescription: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn metadata(&self) -> &[IndexMetadata];
fn type_url(&self) -> &str;
fn index_type(&self) -> &str;
fn rows_indexed(&self) -> u64;
fn field_ids(&self) -> &[u32];
fn details(&self) -> Result<String, Error>;
fn total_size_bytes(&self) -> Option<u64>;
// Provided method
fn segments(&self) -> &[IndexMetadata] { ... }
}Expand description
Additional information about an index
Note that a single index might consist of multiple segments. Each segment has its own UUID and collection of files and covers some subset of the data fragments.
All segments in an index should have the same index type and index details.
Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Returns the index name
This is the user-defined name of the index. It is shared by all segments of the index and is what is used to refer to the index in the API. It is guaranteed to be unique within the dataset.
Sourcefn metadata(&self) -> &[IndexMetadata]
fn metadata(&self) -> &[IndexMetadata]
Returns the index metadata
This is the raw metadata information stored in the manifest. There is one IndexMetadata for each segment of the index.
Sourcefn type_url(&self) -> &str
fn type_url(&self) -> &str
Returns the index type URL
This is extracted from the type url of the index details
Sourcefn index_type(&self) -> &str
fn index_type(&self) -> &str
Returns the index type
This is a short string identifier that is friendlier than the type URL but not guaranteed to be unique.
This is calculated by the plugin and will be “Unknown” if no plugin could be found for the type URL.
Sourcefn rows_indexed(&self) -> u64
fn rows_indexed(&self) -> u64
Returns the number of rows indexed by the index, across all segments.
This is an approximate count and may include rows that have been deleted.
Sourcefn details(&self) -> Result<String, Error>
fn details(&self) -> Result<String, Error>
Returns a JSON string representation of the index details
The format of these details will vary depending on the index type and since indexes can be provided by plugins we cannot fully define it here.
However, plugins should do their best to maintain backwards compatibility and consider this method part of the public API.
See individual index plugins for more description of the expected format.
The conversion from Any to JSON is controlled by the index plugin. As a result, this method may fail if there is no plugin available for the index.
Sourcefn total_size_bytes(&self) -> Option<u64>
fn total_size_bytes(&self) -> Option<u64>
Returns the total size in bytes of all files across all segments.
Returns None if file size information is not available for any segment
(for backward compatibility with indices created before file tracking was added).
Provided Methods§
Sourcefn segments(&self) -> &[IndexMetadata]
fn segments(&self) -> &[IndexMetadata]
Returns the physical index segments that make up this logical index.
This is an alias for Self::metadata with a less ambiguous name.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".