milvus/pkg/streaming/walimpls/scanner.go
chyezh d2bc4a53be
enhance: implement rmq and pulsar as wal (#34046)
issue: #33285

- use reader but not consumer for pulsar
- advanced test framework
- move some streaming related package into pkg

---------

Signed-off-by: chyezh <chyezh@outlook.com>
2024-06-27 15:11:05 +08:00

39 lines
1.2 KiB
Go

package walimpls
import (
"github.com/milvus-io/milvus/pkg/streaming/util/message"
"github.com/milvus-io/milvus/pkg/streaming/util/options"
)
type ReadOption struct {
// The name of the reader.
Name string
// ReadAheadBufferSize sets the size of scanner read ahead queue size.
// Control how many messages can be read ahead by the scanner.
// Higher value could potentially increase the scanner throughput but bigger memory utilization.
// 0 is the default value determined by the underlying wal implementation.
ReadAheadBufferSize int
// DeliverPolicy sets the deliver policy of the reader.
DeliverPolicy options.DeliverPolicy
}
// ScannerImpls is the interface for reading records from the wal.
type ScannerImpls interface {
// Name returns the name of scanner.
Name() string
// Chan returns the channel of message.
Chan() <-chan message.ImmutableMessage
// Error returns the error of scanner failed.
// Will block until scanner is closed or Chan is dry out.
Error() error
// Done returns a channel which will be closed when scanner is finished or closed.
Done() <-chan struct{}
// Close the scanner, release the underlying resources.
// Return the error same with `Error`
Close() error
}