-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Introduce Codec #557
Conversation
Signed-off-by: David <[email protected]>
Signed-off-by: David <[email protected]>
internal/apicodec/codec.go
Outdated
// EncodeRange encodes key range. | ||
EncodeRange(start, end []byte) ([]byte, []byte) | ||
// DecodeRange decodes key range. | ||
DecodeRange(encodedStart, encodedEnd []byte) ([]byte, []byte) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seem DecodeRange will not be used in the code.
EncodeRegionKey(key []byte) []byte | ||
// DecodeRegionKey decode region's key | ||
DecodeRegionKey(encodedKey []byte) ([]byte, error) | ||
// EncodeRegionRange encode region's start and end. | ||
EncodeRegionRange(start, end []byte) ([]byte, []byte) | ||
// DecodeRegionRange decode region's start and end. | ||
DecodeRegionRange(encodedStart, encodedEnd []byte) ([]byte, []byte, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For PD requests, EncodePDQueryKey
and DecodeRegion
should be enough.
Signed-off-by: David <[email protected]>
Signed-off-by: David <[email protected]>
Signed-off-by: David <[email protected]>
Signed-off-by: David <[email protected]>
for _, encodedPair := range encodedPairs { | ||
var err error | ||
p := *encodedPair | ||
if p.Error != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seem this if
could be eliminated.
There is a bug that might block this pull request: client-go/txnkv/txnsnapshot/scan.go Line 217 in bb026bd
if len(reqEndKey) == 0 || (len(loc.EndKey) > 0 && bytes.Compare(loc.EndKey, reqEndKey) < 0) {
reqEndKey = loc.EndKey
} |
Signed-off-by: David <[email protected]>
Signed-off-by: David <[email protected]>
Signed-off-by: David <[email protected]>
Signed-off-by: David <[email protected]>
@@ -76,7 +76,9 @@ func (s *apiTestSuite) newRawKVClient(pdCli pd.Client, addrs []string) *rawkv.Cl | |||
|
|||
func (s *apiTestSuite) wrapPDClient(pdCli pd.Client, addrs []string) pd.Client { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addrs
not be used?
Signed-off-by: iosmanthus <[email protected]>
Signed-off-by: iosmanthus <[email protected]>
Signed-off-by: iosmanthus <[email protected]>
Signed-off-by: iosmanthus <[email protected]>
Signed-off-by: iosmanthus <[email protected]>
Signed-off-by: iosmanthus <[email protected]>
Signed-off-by: iosmanthus <[email protected]>
Signed-off-by: iosmanthus <[email protected]>
This PR aims unify
CodecPDClient
andCodecPDClientV2
by introducing aCodec
interface.