-
Notifications
You must be signed in to change notification settings - Fork 3
/
stage_context.go
29 lines (27 loc) · 3.26 KB
/
stage_context.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package sif
import "context"
// A StageContext is a Context enhanced to store Stage state during execution of a Stage
type StageContext interface {
context.Context
ShuffleBuckets() []uint64 // ShuffleBuckets returns the shuffle buckets for this stage, or an empty slice if there are none
SetShuffleBuckets([]uint64) error // SetShuffleBuckets configures the shuffle buckets for this Stage
OutgoingSchema() Schema // OutgoingSchema returns the initial underlying data schema for the next stage (or the current Stage if this is the last Stage)
SetOutgoingSchema(schema Schema) error // SetOutgoingSchema sets the initial underlying data schema for the next stage within this StageContext (or sets to the current Stage schema if this is the last Stage)
PartitionCache() PartitionCache // PartitionCache returns the configured PartitionCache for this Stage, or nil if none exists
SetPartitionCache(cache PartitionCache) error // SetPartitionCache configures the PartitionCache for this Stage, returning an error if one is already set
PartitionIndex() PartitionIndex // PartitionIndex returns the PartitionIndex for this StageContext, or nil if one has not been set
SetPartitionIndex(idx PartitionIndex) error // SetPartitionIndex sets the PartitionIndex for this StageContext. An error is returned if one has already been set.
IncomingPartitionIterator() PartitionIterator // IncomingPartitionIndex returns the incoming PartitionIterator for this StageContext, or nil if one has not been set
SetIncomingPartitionIterator(i PartitionIterator) error // SetIncomingPartitionIndex sets the incoming PartitionIterator for this StageContext. An error is returned if one has already been set.
KeyingOperation() KeyingOperation // KeyingOperation retrieves the KeyingOperation for this Stage (if it exists)
SetKeyingOperation(keyFn KeyingOperation) error // Configure the keying operation for the end of this stage
ReductionOperation() ReductionOperation // ReductionOperation retrieves the ReductionOperation for this Stage (if it exists)
SetReductionOperation(reduceFn ReductionOperation) error // Configure the reduction operation for the end of this stage
Accumulator() Accumulator // Accumulator retrieves the Accumulator for this Stage (if it exists)
SetAccumulator(acc Accumulator) error // Configure the accumulator for the end of this stage
CollectionLimit() int // CollectionLimit retrieves the CollectionLimit for this Stage (or -1 if unset)
SetCollectionLimit(limit int) error // Configure the CollectionLimit for the end of this stage
TargetPartitionSize() int // TargetPartitionSize returns the intended Partition maxSize for outgoing Partitions
SetTargetPartitionSize(TargetPartitionSize int) error // SetTargetPartitionSize configures the intended Partition maxSize for outgoing Partitions
Destroy() error // Destroys anything using a lot of memory or goroutines within this StageContext
}