|
1 | 1 | use crate::{core::Prop, db::api::storage::graph::tprop_storage_ops::TPropOps};
|
2 |
| -use raphtory_api::core::storage::timeindex::TimeIndexEntry; |
| 2 | +use raphtory_api::{ |
| 3 | + core::storage::timeindex::{TimeIndexEntry, TimeIndexIntoOps, TimeIndexOps}, |
| 4 | + iter::BoxedLIter, |
| 5 | +}; |
3 | 6 | use rayon::iter::{
|
4 | 7 | plumbing::{Consumer, ProducerCallback, UnindexedConsumer},
|
5 | 8 | IndexedParallelIterator, ParallelIterator,
|
@@ -278,3 +281,68 @@ impl<'a, Mem: TPropOps<'a> + 'a, #[cfg(feature = "storage")] Disk: TPropOps<'a>
|
278 | 281 | for_all!(self, props => props.at(ti))
|
279 | 282 | }
|
280 | 283 | }
|
| 284 | + |
| 285 | +impl< |
| 286 | + Mem: TimeIndexOps, |
| 287 | + #[cfg(feature = "storage")] Disk: TimeIndexOps<IndexType = Mem::IndexType>, |
| 288 | + > TimeIndexOps for SelfType!(Mem, Disk) |
| 289 | +{ |
| 290 | + type IndexType = Mem::IndexType; |
| 291 | + |
| 292 | + #[cfg(feature = "storage")] |
| 293 | + type RangeType<'a> |
| 294 | + = StorageVariants<Mem::RangeType<'a>, Disk::RangeType<'a>> |
| 295 | + where |
| 296 | + Self: 'a; |
| 297 | + |
| 298 | + #[cfg(not(feature = "storage"))] |
| 299 | + type RangeType<'a> |
| 300 | + = Mem::RangeType<'a> |
| 301 | + where |
| 302 | + Self: 'a; |
| 303 | + |
| 304 | + fn active(&self, w: Range<Self::IndexType>) -> bool { |
| 305 | + for_all!(self, props => props.active(w)) |
| 306 | + } |
| 307 | + |
| 308 | + fn range(&self, w: Range<Self::IndexType>) -> Self::RangeType<'_> { |
| 309 | + for_all_iter!(self, props => props.range(w)) |
| 310 | + } |
| 311 | + |
| 312 | + fn first(&self) -> Option<Self::IndexType> { |
| 313 | + for_all!(self, props => props.first()) |
| 314 | + } |
| 315 | + |
| 316 | + fn last(&self) -> Option<Self::IndexType> { |
| 317 | + for_all!(self, props => props.last()) |
| 318 | + } |
| 319 | + |
| 320 | + fn iter(&self) -> BoxedLIter<Self::IndexType> { |
| 321 | + for_all!(self, props => props.iter()) |
| 322 | + } |
| 323 | + |
| 324 | + fn len(&self) -> usize { |
| 325 | + for_all!(self, props => props.len()) |
| 326 | + } |
| 327 | +} |
| 328 | + |
| 329 | +impl< |
| 330 | + Mem: TimeIndexIntoOps, |
| 331 | + #[cfg(feature = "storage")] Disk: TimeIndexIntoOps<IndexType = Mem::IndexType>, |
| 332 | + > TimeIndexIntoOps for SelfType!(Mem, Disk) |
| 333 | +{ |
| 334 | + type IndexType = Mem::IndexType; |
| 335 | + #[cfg(feature = "storage")] |
| 336 | + type RangeType = StorageVariants<Mem::RangeType, Disk::RangeType>; |
| 337 | + |
| 338 | + #[cfg(not(feature = "storage"))] |
| 339 | + type RangeType = Mem::RangeType; |
| 340 | + |
| 341 | + fn into_range(self, w: Range<Self::IndexType>) -> Self::RangeType { |
| 342 | + for_all_iter!(self, props => props.into_range(w)) |
| 343 | + } |
| 344 | + |
| 345 | + fn into_iter(self) -> impl Iterator<Item = Self::IndexType> + Send + Sync { |
| 346 | + for_all_iter!(self, props => props.into_iter()) |
| 347 | + } |
| 348 | +} |
0 commit comments