MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / fixture

Function fixture

atomic-repository/src/change_source/performance.rs:95–147  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93}
94
95fn fixture() -> (
96 Vec<RepoPath>,
97 Vec<CanonicalTrackedPath>,
98 BTreeMap<RepoPath, FileIndexV2Entry>,
99 Hash,
100 FileIndexTimestamp,
101) {
102 let policy = Hash::of(b"100k-policy");
103 let boundary = FileIndexTimestamp {
104 seconds: 3,
105 nanoseconds: 0,
106 };
107 let racy_after = FileIndexTimestamp {
108 seconds: 2,
109 nanoseconds: 0,
110 };
111 let content = Hash::of(CONTENT);
112 let mut paths = Vec::with_capacity(PATHS);
113 let mut tracked = Vec::with_capacity(PATHS);
114 let mut index = BTreeMap::new();
115 for number in 0..PATHS {
116 let path = RepoPath::from_bytes(format!("file-{number:06}.txt").as_bytes()).unwrap();
117 tracked.push(CanonicalTrackedPath {
118 path: path.clone(),
119 canonical_mode: 0o644,
120 canonical_kind: InodeKind::Regular,
121 });
122 index.insert(
123 path.clone(),
124 FileIndexV2Entry::complete(
125 7,
126 number as u64 + 1,
127 FileIndexTimestamp {
128 seconds: 1,
129 nanoseconds: 0,
130 },
131 FileIndexTimestamp {
132 seconds: 1,
133 nanoseconds: 0,
134 },
135 CONTENT.len() as u64,
136 content,
137 0o644,
138 InodeKind::Regular,
139 racy_after,
140 policy,
141 )
142 .unwrap(),
143 );
144 paths.push(path);
145 }
146 (paths, tracked, index, policy, boundary)
147}
148
149fn incremental_source(
150 kind: ChangeSourceKind,

Calls 6

unwrapMethod · 0.45
as_bytesMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45
insertMethod · 0.45
lenMethod · 0.45