Struct splinter::registry::UnifiedRegistry [−][src]
pub struct UnifiedRegistry { /* fields omitted */ }
Expand description
A registry with multiple sources.
The UnifiedRegistry
provides a unified view of multiple source registries. It has one internal
read-write registry and an arbitrary number of external read-only registries.
Writing
All write operations (provided by the implementation of the RegistryWriter
trait) affect
only the internal read-write registry.
Reading
Read operations (provided by the RegistryReader
implementation) provide Node
data from
all source registries.
If a Node
exists in more than one registry (nodes are considered duplicates if they have the
same identity
), then the definition of the Node
from the registry with the highest
precedence is used, with the exception of the node’s metadata
(see the Metadata Merging
section below).
If reading a source registry fails, the error will be logged and the registry will be ignored.
Registry Precedence
The internal read-write registry has the highest precedence, followed by the read-only registries. The precedence of the read-only registries is based on the order they appear (the earlier in the list, the higher the priority).
Metadata Merging
When the same node exists in multiple registries, the metadata
is merged from all sources.
If the same metadata key is set for the node in different registires, the value for that key
from the highest-precedence registry will be used.
Implementations
pub fn new(
internal_source: Box<dyn RwRegistry>,
external_sources: Vec<Box<dyn RegistryReader>>
) -> Self
pub fn new(
internal_source: Box<dyn RwRegistry>,
external_sources: Vec<Box<dyn RegistryReader>>
) -> Self
Constructs a new UnifiedRegistry
with an internal read-write registry and an arbitrary
number of read-only registries.
Trait Implementations
fn list_nodes<'a, 'b: 'a>(
&'b self,
predicates: &'a [MetadataPredicate]
) -> Result<NodeIter<'a>, RegistryError>
fn list_nodes<'a, 'b: 'a>(
&'b self,
predicates: &'a [MetadataPredicate]
) -> Result<NodeIter<'a>, RegistryError>
Returns an iterator over the nodes in the registry. Read more
Returns the count of nodes in the registry. Read more
Returns the node with the given identity, if it exists in the registry. Read more
Clone implementation for RwRegistry
. The implementation of the Clone
trait for
Box<RwRegistry>
calls this method. Read more
Clone the RwRegistry
as a Box<dyn RegistryReader>
.
Clone the RwRegistry
as a Box<dyn RegistryWriter>
.
Auto Trait Implementations
impl !RefUnwindSafe for UnifiedRegistry
impl Send for UnifiedRegistry
impl Sync for UnifiedRegistry
impl Unpin for UnifiedRegistry
impl !UnwindSafe for UnifiedRegistry
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Convert self
to an expression for Diesel’s query builder. Read more
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
Convert &self
to an expression for Diesel’s query builder. Read more
type Output = T
type Output = T
Should always be Self