pub struct ObjectContext {
pub usecase: String,
pub scopes: Scopes,
}Expand description
Defines where an object belongs within the object store.
This is part of the full object identifier, see ObjectId.
Fields§
§usecase: StringThe usecase, or “product” this object belongs to.
This can be defined on-the-fly by the client, but special server logic (such as the concrete backend/bucket) can be tied to this as well.
scopes: ScopesThe scopes of the object, used for compartmentalization and authorization.
Scopes are hierarchical key-value pairs that act as containers for objects. The first, top-level scope can contain sub scopes, like a structured nested folder system. As such, scopes are used for isolation and access authorization.
§Ordering
Note that the order of scopes matters! For example, organization=17,project=42 indicates
that project 42 is part of organization 17. If an object were created with these scopes
reversed, it counts as a different object.
Not every object within a usecase needs to have the same scopes. It is perfectly valid to create objects with disjunct or a subset of scopes. However, by convention, we recommend to use the same scopes for all objects within a usecase where possible.
§Creation
To create scopes, collect from an iterator of Scopes. Since scopes must be validated,
you must use Scope::create to create them:
use objectstore_service::id::ObjectContext;
use objectstore_types::scope::{Scope, Scopes};
let object_id = ObjectContext {
usecase: "my_usecase".to_string(),
scopes: Scopes::from_iter([
Scope::create("organization", "17").unwrap(),
Scope::create("project", "42").unwrap(),
]),
};Trait Implementations§
Source§impl Clone for ObjectContext
impl Clone for ObjectContext
Source§fn clone(&self) -> ObjectContext
fn clone(&self) -> ObjectContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ObjectContext
impl Debug for ObjectContext
Source§impl Hash for ObjectContext
impl Hash for ObjectContext
Source§impl PartialEq for ObjectContext
impl PartialEq for ObjectContext
impl Eq for ObjectContext
impl StructuralPartialEq for ObjectContext
Auto Trait Implementations§
impl Freeze for ObjectContext
impl RefUnwindSafe for ObjectContext
impl Send for ObjectContext
impl Sync for ObjectContext
impl Unpin for ObjectContext
impl UnwindSafe for ObjectContext
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].