@@ -42,6 +42,10 @@ pub struct Collection<G: Scope, D, R: Semigroup = isize> {
4242 ///
4343 /// This field is exposed to support direct timely dataflow manipulation when required, but it is
4444 /// not intended to be the idiomatic way to work with the collection.
45+ ///
46+ /// The timestamp in the data is required to always be at least the timestamp _of_ the data, in
47+ /// the timely-dataflow sense. If this invariant is not upheld, differential operators may behave
48+ /// unexpectedly.
4549 pub inner : Stream < G , ( D , G :: Timestamp , R ) >
4650}
4751
@@ -52,6 +56,9 @@ impl<G: Scope, D: Data, R: Semigroup> Collection<G, D, R> where G::Timestamp: Da
5256 /// idiomatic approach to convert timely streams to collections. Also, the `input::Input` trait
5357 /// provides a `new_collection` method which will create a new collection for you without exposing
5458 /// the underlying timely stream at all.
59+ ///
60+ /// This stream should satisfy the timestamp invariant as documented on [Collection]; this
61+ /// method does not check it.
5562 pub fn new ( stream : Stream < G , ( D , G :: Timestamp , R ) > ) -> Collection < G , D , R > {
5663 Collection { inner : stream }
5764 }
@@ -406,8 +413,9 @@ impl<G: Scope, D: Data, R: Semigroup> Collection<G, D, R> where G::Timestamp: Da
406413 ///
407414 /// It is assumed that `func` only advances timestamps; this is not verified, and things may go horribly
408415 /// wrong if that assumption is incorrect. It is also critical that `func` be monotonic: if two times are
409- /// ordered, they should have the same order once `func` is applied to them (this is because we advance the
410- /// timely capability with the same logic, and it must remain `less_equal` to all of the data timestamps).
416+ /// ordered, they should have the same order or compare equal once `func` is applied to them (this
417+ /// is because we advance the timely capability with the same logic, and it must remain `less_equal`
418+ /// to all of the data timestamps).
411419 pub fn delay < F > ( & self , func : F ) -> Collection < G , D , R >
412420 where F : FnMut ( & G :: Timestamp ) -> G :: Timestamp + Clone + ' static {
413421
@@ -419,6 +427,7 @@ impl<G: Scope, D: Data, R: Semigroup> Collection<G, D, R> where G::Timestamp: Da
419427 . map_in_place ( move |x| x. 1 = func2 ( & x. 1 ) )
420428 . as_collection ( )
421429 }
430+
422431 /// Applies a supplied function to each update.
423432 ///
424433 /// This method is most commonly used to report information back to the user, often for debugging purposes.
@@ -679,6 +688,10 @@ pub trait AsCollection<G: Scope, D: Data, R: Semigroup> {
679688}
680689
681690impl < G : Scope , D : Data , R : Semigroup > AsCollection < G , D , R > for Stream < G , ( D , G :: Timestamp , R ) > {
691+ /// Converts the type to a differential dataflow collection.
692+ ///
693+ /// By calling this method, you guarantee that the timestamp invariant (as documented on
694+ /// [Collection]) is upheld. This method will not check it.
682695 fn as_collection ( & self ) -> Collection < G , D , R > {
683696 Collection :: new ( self . clone ( ) )
684697 }
0 commit comments