Documentation
¶
Overview ¶
Package streaming implement the flow framework to provide the sliding window, top-n aggregation, and etc.
Index ¶
- func New(name string, source flow.Source) flow.Flow
- func NewTumblingTimeWindows(size time.Duration, maxFlushInterval time.Duration) flow.WindowAssigner
- func TopN[K TopSortKey](wf flow.WindowedFlow, topNum int, sortKeyExtractor func(flow.StreamRecord) K, ...) flow.Flow
- type TopNOption
- type TopNSort
- type TopSortKey
- type Tuple2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTumblingTimeWindows ¶
NewTumblingTimeWindows return tumbling-time windows.
func TopN ¶ added in v0.11.0
func TopN[K TopSortKey](wf flow.WindowedFlow, topNum int, sortKeyExtractor func(flow.StreamRecord) K, opts ...any) flow.Flow
TopN creates a TopN flow from a windowed flow.
Types ¶
type TopNOption ¶
type TopNOption func(*topNConfig)
TopNOption is the option to set up a TopN config.
func WithGroupKeyExtractor ¶ added in v0.4.0
func WithGroupKeyExtractor(groupKeyExtractor func(flow.StreamRecord) string) TopNOption
WithGroupKeyExtractor extract group key from the StreamRecord.
func WithKeyExtractor ¶ added in v0.7.1
func WithKeyExtractor(keyExtractor func(flow.StreamRecord) uint64) TopNOption
WithKeyExtractor sets a closure to extract the key.
type TopSortKey ¶ added in v0.11.0
TopSortKey defines the constraint for sort keys in TopN operations.
type Tuple2 ¶
type Tuple2[K TopSortKey] struct { V1 K `json:"v1"` V2 flow.StreamRecord `json:"v2"` }
Tuple2 is a tuple with 2 fields. V1 is the sort key (K), V2 is the record.
Click to show internal directories.
Click to hide internal directories.