Documentation ¶
Index ¶
- Variables
- type DataStorageScanner
- type ScanOption
- func WithScanBuffer(buffer *buf.ByteBuf) ScanOption
- func WithScanBytesLimit(value uint64) ScanOption
- func WithScanCountLimit(value uint64) ScanOption
- func WithScanEndKey(endKey []byte) ScanOption
- func WithScanFilterFunc(filterFunc func([]byte) bool) ScanOption
- func WithScanStartKey(startKey []byte) ScanOption
- func WithValue() ScanOption
- type ScanStartKeyPolicy
Constants ¶
This section is empty.
Variables ¶
var ( // None no need to next scan None = ScanStartKeyPolicy(0) // GenWithResultLastKey use `kv.NextKey(last result key)` as startKey for next scan GenWithResultLastKey = ScanStartKeyPolicy(1) // UseShardEnd use the endKey of the shard as startKey for next scan UseShardEnd = ScanStartKeyPolicy(2) )
Functions ¶
This section is empty.
Types ¶
type DataStorageScanner ¶
type DataStorageScanner interface { // Scan Scan the data in the specified shard to satisfy the conditions, // the qualifying conditions can be specified using options. // // When a key satisfies the condition, the handler will be called. // The key and value passed to the handler are not safe and will be reused // between multiple handler calls, and need to be copied if they need to be saved. // // completed to true means that the scan is completed in all shards, otherwise the // client needs nextKeyPolicy to create the startKey for the next scan. Scan(shard meta.Shard, handler func(key, value []byte) error, options ...ScanOption) (completed bool, nextKeyPolicy ScanStartKeyPolicy, err error) }
DataStorageScanner
func NewKVBasedDataStorageScanner ¶
func NewKVBasedDataStorageScanner(kv storage.KVStorage) DataStorageScanner
NewKVBasedDataStorageScanner create a kv based DataStorageScanner
type ScanOption ¶
type ScanOption func(*scanOptions)
ScanOption scan option func
func WithScanBuffer ¶
func WithScanBuffer(buffer *buf.ByteBuf) ScanOption
WithScanBuffer set the buffer of scan to avoid memory overhead
func WithScanBytesLimit ¶
func WithScanBytesLimit(value uint64) ScanOption
WithScanBytesLimit set the maximum number of bytes of data to be included in the result
func WithScanCountLimit ¶
func WithScanCountLimit(value uint64) ScanOption
WithScanCountLimit set the maximum number of data to be included in the result
func WithScanEndKey ¶
func WithScanEndKey(endKey []byte) ScanOption
WithScanEndKey set the endKey of scan
func WithScanFilterFunc ¶
func WithScanFilterFunc(filterFunc func([]byte) bool) ScanOption
WithScanFilterFunc set the key filter and return true to indicate that the record meets the condition
func WithScanStartKey ¶
func WithScanStartKey(startKey []byte) ScanOption
WithScanStartKey set the startKey of scan
func WithValue ¶
func WithValue() ScanOption
WithValue set whether the return result of scan contains value
type ScanStartKeyPolicy ¶
type ScanStartKeyPolicy int
ScanStartKeyPolicy calculation strategy for the startKey of next scan