@@ -434,85 +434,84 @@ where
434
434
}
435
435
}
436
436
437
- /// A type that can be arranged into a trace of type `T `.
437
+ /// A type that can be arranged as if a collection of updates shaped as `((K,V),G::Timestamp,R) `.
438
438
///
439
- /// This trait is implemented for appropriately typed collections and all traces that might accommodate them,
440
- /// as well as by arranged data for their corresponding trace type.
441
- pub trait Arrange < G : Scope , K , V , R : Semigroup >
439
+ /// This trait is primarily implemented by `Collection<G,(K,V),R>`.
440
+ ///
441
+ /// The resulting arrangements may not present as `((K,V),T,R)`, as their output types are unconstrained.
442
+ /// This allows e.g. for `Vec<u8>` inputs to present as `&[u8]` when read, but that relationship is not
443
+ /// constrained by this trait.
444
+ pub trait Arrange < G , K , V , R >
442
445
where
446
+ G : Scope ,
443
447
G :: Timestamp : Lattice ,
444
- K : ToOwned + ?Sized ,
445
- K :: Owned : Data ,
446
- V : Data ,
448
+ R : Semigroup
447
449
{
448
- /// Arranges a stream of `(Key, Val)` updates by `Key`. Accepts an empty instance of the trace type.
450
+ /// Arranges a stream of `(Key, Val)` updates by `Key`.
449
451
///
450
452
/// This operator arranges a stream of values into a shared trace, whose contents it maintains.
451
- /// This trace is current for all times marked completed in the output stream, and probing this stream
452
- /// is the correct way to determine that times in the shared trace are committed.
453
453
fn arrange < Tr > ( & self ) -> Arranged < G , TraceAgent < Tr > >
454
454
where
455
- K :: Owned : ExchangeData +Hashable ,
455
+ Tr : Trace < Time =G :: Timestamp > + ' static ,
456
+ K : ExchangeData + Hashable ,
456
457
V : ExchangeData ,
457
458
R : ExchangeData ,
458
- Tr : Trace < Key =K > +TraceReader < Time =G :: Timestamp > +' static ,
459
459
Tr :: Batch : Batch ,
460
- Tr :: Batcher : Batcher < Item = ( ( K :: Owned , V ) , G :: Timestamp , R ) , Time = G :: Timestamp > ,
461
- Tr :: Builder : Builder < Item = ( ( K :: Owned , V ) , G :: Timestamp , R ) , Time = G :: Timestamp , Output = Tr :: Batch > ,
460
+ Tr :: Batcher : Batcher < Item = ( ( K , V ) , G :: Timestamp , R ) , Time = G :: Timestamp > ,
461
+ Tr :: Builder : Builder < Item = ( ( K , V ) , G :: Timestamp , R ) , Time = G :: Timestamp , Output = Tr :: Batch > ,
462
462
{
463
463
self . arrange_named ( "Arrange" )
464
464
}
465
465
466
- /// Arranges a stream of `(Key, Val)` updates by `Key`. Accepts an empty instance of the trace type .
466
+ /// Arranges a stream of `(Key, Val)` updates by `Key`, and presents with a `name` argument .
467
467
///
468
468
/// This operator arranges a stream of values into a shared trace, whose contents it maintains.
469
- /// This trace is current for all times marked completed in the output stream, and probing this stream
470
- /// is the correct way to determine that times in the shared trace are committed.
471
469
fn arrange_named < Tr > ( & self , name : & str ) -> Arranged < G , TraceAgent < Tr > >
472
470
where
473
- K :: Owned : ExchangeData +Hashable ,
471
+ Tr : Trace < Time =G :: Timestamp > + ' static ,
472
+ K : ExchangeData + Hashable ,
474
473
V : ExchangeData ,
475
474
R : ExchangeData ,
476
- Tr : Trace < Key =K > +TraceReader < Time =G :: Timestamp > +' static ,
477
475
Tr :: Batch : Batch ,
478
- Tr :: Batcher : Batcher < Item = ( ( K :: Owned , V ) , G :: Timestamp , R ) , Time = G :: Timestamp > ,
479
- Tr :: Builder : Builder < Item = ( ( K :: Owned , V ) , G :: Timestamp , R ) , Time = G :: Timestamp , Output = Tr :: Batch > ,
476
+ Tr :: Batcher : Batcher < Item = ( ( K , V ) , G :: Timestamp , R ) , Time = G :: Timestamp > ,
477
+ Tr :: Builder : Builder < Item = ( ( K , V ) , G :: Timestamp , R ) , Time = G :: Timestamp , Output = Tr :: Batch > ,
480
478
{
481
- let exchange = Exchange :: new ( move |update : & ( ( K :: Owned , V ) , G :: Timestamp , R ) | ( update. 0 ) . 0 . hashed ( ) . into ( ) ) ;
479
+ let exchange = Exchange :: new ( move |update : & ( ( K , V ) , G :: Timestamp , R ) | ( update. 0 ) . 0 . hashed ( ) . into ( ) ) ;
482
480
self . arrange_core ( exchange, name)
483
481
}
484
482
485
- /// Arranges a stream of `(Key, Val)` updates by `Key`. Accepts an empty instance of the trace type .
483
+ /// Arranges a stream of `(Key, Val)` updates by `Key`, configured with a name and a parallelization contract .
486
484
///
487
485
/// This operator arranges a stream of values into a shared trace, whose contents it maintains.
488
- /// This trace is current for all times marked completed in the output stream, and probing this stream
489
- /// is the correct way to determine that times in the shared trace are committed .
486
+ /// It uses the supplied parallelization contract to distribute the data, which does not need to
487
+ /// be consistently by key (though this is the most common) .
490
488
fn arrange_core < P , Tr > ( & self , pact : P , name : & str ) -> Arranged < G , TraceAgent < Tr > >
491
489
where
492
- P : ParallelizationContract < G :: Timestamp , ( ( K :: Owned , V ) , G :: Timestamp , R ) > ,
493
- Tr : Trace < Key =K > +TraceReader < Time =G :: Timestamp > +' static ,
490
+ P : ParallelizationContract < G :: Timestamp , ( ( K , V ) , G :: Timestamp , R ) > ,
491
+ K : Clone ,
492
+ V : Clone ,
493
+ Tr : Trace < Time =G :: Timestamp > +' static ,
494
494
Tr :: Batch : Batch ,
495
- Tr :: Batcher : Batcher < Item = ( ( K :: Owned , V ) , G :: Timestamp , R ) , Time = G :: Timestamp > ,
496
- Tr :: Builder : Builder < Item = ( ( K :: Owned , V ) , G :: Timestamp , R ) , Time = G :: Timestamp , Output = Tr :: Batch > ,
495
+ Tr :: Batcher : Batcher < Item = ( ( K , V ) , G :: Timestamp , R ) , Time = G :: Timestamp > ,
496
+ Tr :: Builder : Builder < Item = ( ( K , V ) , G :: Timestamp , R ) , Time = G :: Timestamp , Output = Tr :: Batch > ,
497
497
;
498
498
}
499
499
500
- impl < G , K , V , R > Arrange < G , K , V , R > for Collection < G , ( K :: Owned , V ) , R >
500
+ impl < G , K , V , R > Arrange < G , K , V , R > for Collection < G , ( K , V ) , R >
501
501
where
502
502
G : Scope ,
503
- G :: Timestamp : Lattice +Ord ,
504
- K : ToOwned + ?Sized ,
505
- K :: Owned : Data ,
506
- V : Data ,
503
+ G :: Timestamp : Lattice ,
504
+ K : Clone + ' static ,
505
+ V : Clone + ' static ,
507
506
R : Semigroup ,
508
507
{
509
508
fn arrange_core < P , Tr > ( & self , pact : P , name : & str ) -> Arranged < G , TraceAgent < Tr > >
510
509
where
511
- P : ParallelizationContract < G :: Timestamp , ( ( K :: Owned , V ) , G :: Timestamp , R ) > ,
512
- Tr : Trace < Key = K > + TraceReader < Time =G :: Timestamp > +' static ,
510
+ P : ParallelizationContract < G :: Timestamp , ( ( K , V ) , G :: Timestamp , R ) > ,
511
+ Tr : Trace < Time =G :: Timestamp > +' static ,
513
512
Tr :: Batch : Batch ,
514
- Tr :: Batcher : Batcher < Item = ( ( K :: Owned , V ) , G :: Timestamp , R ) , Time = G :: Timestamp > ,
515
- Tr :: Builder : Builder < Item = ( ( K :: Owned , V ) , G :: Timestamp , R ) , Time = G :: Timestamp , Output = Tr :: Batch > ,
513
+ Tr :: Batcher : Batcher < Item = ( ( K , V ) , G :: Timestamp , R ) , Time = G :: Timestamp > ,
514
+ Tr :: Builder : Builder < Item = ( ( K , V ) , G :: Timestamp , R ) , Time = G :: Timestamp , Output = Tr :: Batch > ,
516
515
{
517
516
// The `Arrange` operator is tasked with reacting to an advancing input
518
517
// frontier by producing the sequence of batches whose lower and upper
0 commit comments