candidatebuffer

package
v0.6.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2023 License: Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CandidateBuffer

type CandidateBuffer struct {
	// contains filtered or unexported fields
}

func NewCandidateBuffer

func NewCandidateBuffer(onCandidates func([]types.RetrievalCandidate), clock clock.Clock) *CandidateBuffer

func NewCandidateBufferWithSync

func NewCandidateBufferWithSync(onCandidates func([]types.RetrievalCandidate), clock clock.Clock, afterEach chan<- struct{}) *CandidateBuffer

func (*CandidateBuffer) BufferStream

func (c *CandidateBuffer) BufferStream(ctx context.Context, incoming <-chan types.FindCandidatesResult, bufferingTime time.Duration) error

BufferStream consumes a stream of individual candidate results. When a new result comes in, a collection is started, and further results are added to the collection until the specified bufferingTime has passed, at which point the collection is passed to the callback setup when the Buffer was setup. The timer is reset and the collection emptied until another result comes in. This has the effect of grouping results that occur in the same general time frame.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL