pub struct DocIdRule {
pub template: IdTemplate,
pub set_routing: bool,
}Expand description
Rule to construct a document _id.
In SharedIndex placement the partition id MUST appear in the template so
ids cannot collide across tenants sharing one physical index (docs/03).
osproxy-tenancy enforces this.
§Examples
use osproxy_spi::{DocIdRule, IdTemplate};
let rule = DocIdRule::new(IdTemplate::new("{partition}:{body.order_id}"))
.with_routing(true);
assert!(rule.set_routing);
assert!(rule.template.references_partition());Fields§
§template: IdTemplateThe id template, e.g. {partition}:{body.natural_key}.
set_routing: boolAlso set OpenSearch _routing to the partition id, so the document
lands on a deterministic shard for the partition.
Implementations§
Source§impl DocIdRule
impl DocIdRule
Sourcepub fn new(template: IdTemplate) -> Self
pub fn new(template: IdTemplate) -> Self
Constructs a rule from a template, with routing off.
Sourcepub fn with_routing(self, set_routing: bool) -> Self
pub fn with_routing(self, set_routing: bool) -> Self
Sets set_routing (builder style).
Trait Implementations§
impl Eq for DocIdRule
impl StructuralPartialEq for DocIdRule
Auto Trait Implementations§
impl Freeze for DocIdRule
impl RefUnwindSafe for DocIdRule
impl Send for DocIdRule
impl Sync for DocIdRule
impl Unpin for DocIdRule
impl UnsafeUnpin for DocIdRule
impl UnwindSafe for DocIdRule
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
Mutably borrows from an owned value. Read more