use super::STREAM_POLICY;
use crate::MemorySize;
use crate::model::storage::codec::{Nested, Optional, product};
use crate::model::storage::{ObjectEntry, ObjectSelection, StorageCursor};
use crate::operations::Visibility;
product!(FollowObjects {
after: Optional<Nested<StorageCursor>> => 1,
selection: Nested<ObjectSelection> => 2,
});
crate::declare!(FollowObjects {
id: "storage.follow_objects",
version: 1,
policy: STREAM_POLICY,
response: StorageCursor,
output: ObjectEntry,
visibility: Visibility::Host,
});
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct FollowObjects {
pub after: Option<StorageCursor>,
pub selection: ObjectSelection,
}
impl MemorySize for FollowObjects {
fn memory_size(&self) -> usize {
std::mem::size_of::<Self>()
.saturating_add(self.after.memory_size().saturating_sub(std::mem::size_of_val(&self.after)))
.saturating_add(self.selection.memory_size().saturating_sub(std::mem::size_of_val(&self.selection)))
}
}