candidatebuffer

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 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, queueCandidates func(context.Context, OnNextCandidate) error, 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.

type OnNextCandidate added in v0.7.0

type OnNextCandidate func(types.RetrievalCandidate)

Jump to

Keyboard shortcuts

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