harmos_domain/operations/storage/
follow_file.rs1use super::STREAM_POLICY;
22use crate::MemorySize;
23use crate::model::storage::codec::{Nested, Unsigned, product};
24use crate::model::storage::{FileBatch, FileProgress, StagedFile};
25use crate::operations::Visibility;
26
27product!(FollowFile {
32 file: Nested<StagedFile> => 1,
33 offset: Unsigned => 2,
34});
35
36crate::declare!(FollowFile {
37 id: "storage.follow_file",
38 version: 1,
39 policy: STREAM_POLICY,
40 response: FileProgress,
41 output: FileBatch,
42 visibility: Visibility::Host,
43});
44
45#[derive(Clone, Debug, PartialEq, Eq)]
50pub struct FollowFile {
51 pub file: StagedFile,
52 pub offset: u64,
53}
54
55impl MemorySize for FollowFile {
62 fn memory_size(&self) -> usize {
63 std::mem::size_of::<Self>()
64 .saturating_add(self.file.memory_size().saturating_sub(std::mem::size_of_val(&self.file)))
65 .saturating_add(self.offset.memory_size().saturating_sub(std::mem::size_of_val(&self.offset)))
66 }
67}
68
69