objectstore_service/
path.rs

1use std::fmt::{self, Display};
2
3/// The fully scoped path of an object.
4///
5/// This consists of a usecase, the scope, and the user-defined object key.
6#[derive(Debug, Clone)]
7pub struct ObjectPath {
8    /// The usecase, or "product" this object belongs to.
9    ///
10    /// This can be defined on-the-fly by the client, but special server logic
11    /// (such as the concrete backend/bucket) can be tied to this as well.
12    pub usecase: String,
13
14    /// The scope of the object, used for compartmentalization.
15    ///
16    /// This is treated as a prefix, and includes such things as the organization and project.
17    pub scope: String,
18
19    /// This is a user-defined key, which uniquely identifies the object within its usecase/scope.
20    pub key: String,
21}
22
23impl Display for ObjectPath {
24    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25        write!(f, "{}/{}/{}", self.usecase, self.scope, self.key)
26    }
27}