coven_storage/
publication.rs1use crate::{ObjectPath, StorageError};
3use std::sync::Arc;
4
5pub trait PublicationGate: Send + Sync {
8 fn check(&self, path: &ObjectPath) -> Result<(), StorageError>;
10}
11
12#[derive(Clone)]
14pub struct PublicationRequest {
15 gate: Arc<dyn PublicationGate>,
16 path: ObjectPath,
17}
18impl PublicationRequest {
19 pub(crate) fn new(gate: Arc<dyn PublicationGate>, path: ObjectPath) -> Self {
20 Self { gate, path }
21 }
22 pub fn check(&self) -> Result<(), StorageError> {
25 self.gate.check(&self.path)
26 }
27}
28impl std::fmt::Debug for PublicationRequest {
29 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30 f.debug_struct("PublicationRequest").field("path", &self.path).finish_non_exhaustive()
31 }
32}