mirror of https://github.com/tikv/client-go.git
*: add `SnapshotIterReverse` and make `iterReverse` supports `lowerBound` (#883)
Signed-off-by: Jason Mo <mohangjie1995@gmail.com>
This commit is contained in:
parent
51633ada95
commit
2f119351bd
|
|
@ -6,12 +6,12 @@ require (
|
|||
github.com/ninedraft/israce v0.0.3
|
||||
github.com/pingcap/errors v0.11.5-0.20221009092201-b66cddb77c32
|
||||
github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c
|
||||
github.com/pingcap/kvproto v0.0.0-20230530111525-e4919c190b46
|
||||
github.com/pingcap/kvproto v0.0.0-20230703085931-3788ab4ee6b3
|
||||
github.com/pingcap/tidb v1.1.0-beta.0.20230619015310-8b1006f1af04
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/tidwall/gjson v1.14.1
|
||||
github.com/tikv/client-go/v2 v2.0.8-0.20230615161845-b32f340d0609
|
||||
github.com/tikv/client-go/v2 v2.0.8-0.20230707070242-178f6fa01aab
|
||||
github.com/tikv/pd/client v0.0.0-20230613052906-7158cb319935
|
||||
go.uber.org/goleak v1.2.1
|
||||
)
|
||||
|
|
@ -67,7 +67,7 @@ require (
|
|||
github.com/pingcap/log v1.1.1-0.20230317032135-a0d097d16e22 // indirect
|
||||
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 // indirect
|
||||
github.com/pingcap/tidb/parser v0.0.0-20230619015310-8b1006f1af04 // indirect
|
||||
github.com/pingcap/tipb v0.0.0-20230602100112-acb7942db1ca // indirect
|
||||
github.com/pingcap/tipb v0.0.0-20230607071926-bda24015c2d6 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
|
||||
github.com/prometheus/client_golang v1.15.1 // indirect
|
||||
|
|
@ -95,14 +95,14 @@ require (
|
|||
go.uber.org/atomic v1.11.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.24.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
golang.org/x/crypto v0.10.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230519143937-03e91628a987 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sync v0.2.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
golang.org/x/net v0.11.0 // indirect
|
||||
golang.org/x/sync v0.3.0 // indirect
|
||||
golang.org/x/sys v0.9.0 // indirect
|
||||
golang.org/x/text v0.11.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
golang.org/x/tools v0.9.3 // indirect
|
||||
golang.org/x/tools v0.10.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
|
||||
google.golang.org/grpc v1.54.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
|
|
@ -113,5 +113,7 @@ require (
|
|||
|
||||
replace (
|
||||
github.com/go-ldap/ldap/v3 => github.com/YangKeao/ldap/v3 v3.4.5-0.20230421065457-369a3bab1117
|
||||
github.com/pingcap/tidb => github.com/defined2014/tidb v1.1.0-beta.0.20230712071811-87a5c15e9c7d
|
||||
github.com/pingcap/tidb/parser => github.com/defined2014/tidb/parser v0.0.0-20230712071811-87a5c15e9c7d
|
||||
github.com/tikv/client-go/v2 => ../
|
||||
)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,11 @@ github.com/danjacques/gofslock v0.0.0-20220131014315-6e321f4509c8/go.mod h1:VT5E
|
|||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs=
|
||||
github.com/defined2014/tidb v1.1.0-beta.0.20230712071811-87a5c15e9c7d h1:zpJ8XU5O7Ba4ClrfgFjPir3rJ2xw5lEscWvm5g24GO8=
|
||||
github.com/defined2014/tidb v1.1.0-beta.0.20230712071811-87a5c15e9c7d/go.mod h1:EHSARUioGL7ZY2hjmu9wWyZ1mzSuwjddKwnOlEphiQo=
|
||||
github.com/defined2014/tidb/parser v0.0.0-20230712071811-87a5c15e9c7d h1:pyklrx9LutolLFg1l9CnMPUcvcnhBT2ppsq5zkbthDo=
|
||||
github.com/defined2014/tidb/parser v0.0.0-20230712071811-87a5c15e9c7d/go.mod h1:ENXEsaVS6N3CTMpL4txc6m93y6XaztF9W4SFLjhPWJg=
|
||||
github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4=
|
||||
github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
|
|
@ -149,7 +153,7 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me
|
|||
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
|
||||
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
|
||||
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
|
||||
github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
|
||||
github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
|
|
@ -287,8 +291,8 @@ github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3
|
|||
github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE=
|
||||
github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8=
|
||||
github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI=
|
||||
github.com/lestrrat-go/jwx/v2 v2.0.6 h1:RlyYNLV892Ed7+FTfj1ROoF6x7WxL965PGTHso/60G0=
|
||||
github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4=
|
||||
github.com/lestrrat-go/jwx/v2 v2.0.11 h1:ViHMnaMeaO0qV16RZWBHM7GTrAnX2aFLVKofc7FuKLQ=
|
||||
github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a h1:N9zuLhTvBSRt0gWSiJswwQ2HqDmtX/ZCDJURnKUt1Ik=
|
||||
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a/go.mod h1:JKx41uQRwqlTZabZc+kILPrO/3jlKnQ2Z8b7YiVw5cE=
|
||||
|
|
@ -357,24 +361,20 @@ github.com/pingcap/errors v0.11.5-0.20221009092201-b66cddb77c32 h1:m5ZsBa5o/0Ckz
|
|||
github.com/pingcap/errors v0.11.5-0.20221009092201-b66cddb77c32/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg=
|
||||
github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c h1:CgbKAHto5CQgWM9fSBIvaxsJHuGP0uM74HXtv3MyyGQ=
|
||||
github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c/go.mod h1:4qGtCB0QK0wBzKtFEGDhxXnSnbQApw1gc9siScUl8ew=
|
||||
github.com/pingcap/fn v0.0.0-20200306044125-d5540d389059 h1:Pe2LbxRmbTfAoKJ65bZLmhahmvHm7n9DUxGRQT00208=
|
||||
github.com/pingcap/fn v1.0.0 h1:CyA6AxcOZkQh52wIqYlAmaVmF6EvrcqFywP463pjA8g=
|
||||
github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989 h1:surzm05a8C9dN8dIUmo4Be2+pMRb6f55i+UIYrluu2E=
|
||||
github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989/go.mod h1:O17XtbryoCJhkKGbT62+L2OlrniwqiGLSqrmdHCMzZw=
|
||||
github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w=
|
||||
github.com/pingcap/kvproto v0.0.0-20230530111525-e4919c190b46 h1:GBlml2UIrI9IR3DdBnUWNeXizK4PwJhYPO7eWgCNErg=
|
||||
github.com/pingcap/kvproto v0.0.0-20230530111525-e4919c190b46/go.mod h1:r0q/CFcwvyeRhKtoqzmWMBebrtpIziQQ9vR+JKh1knc=
|
||||
github.com/pingcap/kvproto v0.0.0-20230703085931-3788ab4ee6b3 h1:TN9FcS+r19rKyrsPJDPfcXWkztVHfbpZ9Xkic6kE+v0=
|
||||
github.com/pingcap/kvproto v0.0.0-20230703085931-3788ab4ee6b3/go.mod h1:r0q/CFcwvyeRhKtoqzmWMBebrtpIziQQ9vR+JKh1knc=
|
||||
github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM=
|
||||
github.com/pingcap/log v1.1.0/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=
|
||||
github.com/pingcap/log v1.1.1-0.20230317032135-a0d097d16e22 h1:2SOzvGvE8beiC1Y4g9Onkvu6UmuBBOeWRGQEjJaT/JY=
|
||||
github.com/pingcap/log v1.1.1-0.20230317032135-a0d097d16e22/go.mod h1:DWQW5jICDR7UJh4HtxXSM20Churx4CQL0fwL/SoOSA4=
|
||||
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21 h1:QV6jqlfOkh8hqvEAgwBZa+4bSgO0EeKC7s5c6Luam2I=
|
||||
github.com/pingcap/sysutil v1.0.1-0.20230407040306-fb007c5aff21/go.mod h1:QYnjfA95ZaMefyl1NO8oPtKeb8pYUdnDVhQgf+qdpjM=
|
||||
github.com/pingcap/tidb v1.1.0-beta.0.20230619015310-8b1006f1af04 h1:rBlNvmdFTB+WPFCvCSBQwK8PtoZA7JVblygbn3X8mmg=
|
||||
github.com/pingcap/tidb v1.1.0-beta.0.20230619015310-8b1006f1af04/go.mod h1:Pi4ObsVr4eRNxCyFXsho0uzA/+ZDSjB0ASvaUI3ECUI=
|
||||
github.com/pingcap/tidb/parser v0.0.0-20230619015310-8b1006f1af04 h1:pNz5l+3UFAu040skaE92eyVSlnAPMaCQBRW3E746lMs=
|
||||
github.com/pingcap/tidb/parser v0.0.0-20230619015310-8b1006f1af04/go.mod h1:QKyCQPh1u6N7yXpPElNJzzWL7J70duuRo45GMH0FMNk=
|
||||
github.com/pingcap/tipb v0.0.0-20230602100112-acb7942db1ca h1:J2HQyR5v1AcoBzx5/AYJW9XFSIl6si6YoC6yGI1W89c=
|
||||
github.com/pingcap/tipb v0.0.0-20230602100112-acb7942db1ca/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs=
|
||||
github.com/pingcap/tipb v0.0.0-20230607071926-bda24015c2d6 h1:D79RE4RVhq2ic8sqDSv7QdL0tT5aZV3CaCXUAT41iWc=
|
||||
github.com/pingcap/tipb v0.0.0-20230607071926-bda24015c2d6/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs=
|
||||
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
|
|
@ -424,6 +424,7 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo
|
|||
github.com/sasha-s/go-deadlock v0.2.0 h1:lMqc+fUb7RrFS3gQLtoQsJ7/6TV/pAIFvBsqX73DK8Y=
|
||||
github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10=
|
||||
github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw=
|
||||
github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=
|
||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/shirou/gopsutil/v3 v3.21.12/go.mod h1:BToYZVTlSVlfazpDDYFnsVZLaoRG+g8ufT6fPQLdJzA=
|
||||
github.com/shirou/gopsutil/v3 v3.23.5 h1:5SgDCeQ0KW0S4N0znjeM/eFHXXOKyv2dVNgRq/c9P6Y=
|
||||
|
|
@ -578,8 +579,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
|
|||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||
golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM=
|
||||
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
|
||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20230519143937-03e91628a987 h1:3xJIFvzUFbu4ls0BTBYcgbCGhA63eAOEMxIHugyXJqA=
|
||||
|
|
@ -624,8 +625,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
|
|||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU=
|
||||
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
|
|
@ -641,8 +642,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
|
|||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
|
||||
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.0.0-20180810173357-98c5dad5d1a0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
|
@ -681,13 +682,14 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
|
||||
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
|
||||
golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
|
|
@ -695,8 +697,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
|
||||
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
|
|
@ -724,8 +726,8 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
|||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
|
||||
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
|
||||
golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg=
|
||||
golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
|
|||
|
|
@ -67,10 +67,11 @@ func (db *MemDB) Iter(k []byte, upperBound []byte) (Iterator, error) {
|
|||
// IterReverse creates a reversed Iterator positioned on the first entry which key is less than k.
|
||||
// The returned iterator will iterate from greater key to smaller key.
|
||||
// If k is nil, the returned iterator will be positioned at the last key.
|
||||
// TODO: Add lower bound limit
|
||||
func (db *MemDB) IterReverse(k []byte) (Iterator, error) {
|
||||
// It yields only keys that >= lowerBound. If lowerBound is nil, it means the lowerBound is unbounded.
|
||||
func (db *MemDB) IterReverse(k []byte, lowerBound []byte) (Iterator, error) {
|
||||
i := &MemdbIterator{
|
||||
db: db,
|
||||
start: lowerBound,
|
||||
end: k,
|
||||
reverse: true,
|
||||
}
|
||||
|
|
@ -128,7 +129,7 @@ func (i *MemdbIterator) Valid() bool {
|
|||
if !i.reverse {
|
||||
return !i.curr.isNull() && (i.end == nil || bytes.Compare(i.Key(), i.end) < 0)
|
||||
}
|
||||
return !i.curr.isNull()
|
||||
return !i.curr.isNull() && (i.start == nil || bytes.Compare(i.Key(), i.start) >= 0)
|
||||
}
|
||||
|
||||
// Flags returns flags belong to current iterator.
|
||||
|
|
|
|||
|
|
@ -60,6 +60,21 @@ func (db *MemDB) SnapshotIter(start, end []byte) Iterator {
|
|||
return it
|
||||
}
|
||||
|
||||
// SnapshotIterReverse returns a reverse Iterator for a snapshot of MemBuffer.
|
||||
func (db *MemDB) SnapshotIterReverse(k, lowerBound []byte) Iterator {
|
||||
it := &memdbSnapIter{
|
||||
MemdbIterator: &MemdbIterator{
|
||||
db: db,
|
||||
start: lowerBound,
|
||||
end: k,
|
||||
reverse: true,
|
||||
},
|
||||
cp: db.getSnapshot(),
|
||||
}
|
||||
it.init()
|
||||
return it
|
||||
}
|
||||
|
||||
func (db *MemDB) getSnapshot() MemDBCheckpoint {
|
||||
if len(db.stages) > 0 {
|
||||
return db.stages[0]
|
||||
|
|
@ -123,11 +138,19 @@ func (i *memdbSnapIter) setValue() bool {
|
|||
}
|
||||
|
||||
func (i *memdbSnapIter) init() {
|
||||
if i.reverse {
|
||||
if len(i.end) == 0 {
|
||||
i.seekToLast()
|
||||
} else {
|
||||
i.seek(i.end)
|
||||
}
|
||||
} else {
|
||||
if len(i.start) == 0 {
|
||||
i.seekToFirst()
|
||||
} else {
|
||||
i.seek(i.start)
|
||||
}
|
||||
}
|
||||
|
||||
if !i.setValue() {
|
||||
err := i.Next()
|
||||
|
|
|
|||
|
|
@ -98,14 +98,34 @@ func TestIterator(t *testing.T) {
|
|||
}
|
||||
assert.Equal(i, cnt)
|
||||
|
||||
i--
|
||||
for it, _ := db.IterReverse(nil); it.Valid(); it.Next() {
|
||||
binary.BigEndian.PutUint32(buf[:], uint32(i))
|
||||
for it, _ := db.IterReverse(nil, nil); it.Valid(); it.Next() {
|
||||
binary.BigEndian.PutUint32(buf[:], uint32(i-1))
|
||||
assert.Equal(it.Key(), buf[:])
|
||||
assert.Equal(it.Value(), buf[:])
|
||||
i--
|
||||
}
|
||||
assert.Equal(i, -1)
|
||||
assert.Equal(i, 0)
|
||||
|
||||
var upperBoundBytes, lowerBoundBytes [4]byte
|
||||
bound := 400
|
||||
binary.BigEndian.PutUint32(upperBoundBytes[:], uint32(bound))
|
||||
for it, _ := db.Iter(nil, upperBoundBytes[:]); it.Valid(); it.Next() {
|
||||
binary.BigEndian.PutUint32(buf[:], uint32(i))
|
||||
assert.Equal(it.Key(), buf[:])
|
||||
assert.Equal(it.Value(), buf[:])
|
||||
i++
|
||||
}
|
||||
assert.Equal(i, bound)
|
||||
|
||||
i = cnt
|
||||
binary.BigEndian.PutUint32(lowerBoundBytes[:], uint32(bound))
|
||||
for it, _ := db.IterReverse(nil, lowerBoundBytes[:]); it.Valid(); it.Next() {
|
||||
binary.BigEndian.PutUint32(buf[:], uint32(i-1))
|
||||
assert.Equal(it.Key(), buf[:])
|
||||
assert.Equal(it.Value(), buf[:])
|
||||
i--
|
||||
}
|
||||
assert.Equal(i, bound)
|
||||
}
|
||||
|
||||
func TestDiscard(t *testing.T) {
|
||||
|
|
@ -139,7 +159,7 @@ func TestDiscard(t *testing.T) {
|
|||
assert.Equal(i, cnt)
|
||||
|
||||
i--
|
||||
for it, _ := db.IterReverse(nil); it.Valid(); it.Next() {
|
||||
for it, _ := db.IterReverse(nil, nil); it.Valid(); it.Next() {
|
||||
binary.BigEndian.PutUint32(buf[:], uint32(i))
|
||||
assert.Equal(it.Key(), buf[:])
|
||||
assert.Equal(it.Value(), buf[:])
|
||||
|
|
@ -197,7 +217,7 @@ func TestFlushOverwrite(t *testing.T) {
|
|||
assert.Equal(i, cnt)
|
||||
|
||||
i--
|
||||
for it, _ := db.IterReverse(nil); it.Valid(); it.Next() {
|
||||
for it, _ := db.IterReverse(nil, nil); it.Valid(); it.Next() {
|
||||
binary.BigEndian.PutUint32(kbuf[:], uint32(i))
|
||||
binary.BigEndian.PutUint32(vbuf[:], uint32(i+1))
|
||||
assert.Equal(it.Key(), kbuf[:])
|
||||
|
|
@ -279,7 +299,7 @@ func TestNestedSandbox(t *testing.T) {
|
|||
assert.Equal(i, 200)
|
||||
|
||||
i--
|
||||
for it, _ := db.IterReverse(nil); it.Valid(); it.Next() {
|
||||
for it, _ := db.IterReverse(nil, nil); it.Valid(); it.Next() {
|
||||
binary.BigEndian.PutUint32(kbuf[:], uint32(i))
|
||||
binary.BigEndian.PutUint32(vbuf[:], uint32(i))
|
||||
if i < 100 {
|
||||
|
|
@ -336,7 +356,7 @@ func TestOverwrite(t *testing.T) {
|
|||
assert.Equal(i, cnt)
|
||||
|
||||
i--
|
||||
for it, _ := db.IterReverse(nil); it.Valid(); it.Next() {
|
||||
for it, _ := db.IterReverse(nil, nil); it.Valid(); it.Next() {
|
||||
binary.BigEndian.PutUint32(buf[:], uint32(i))
|
||||
assert.Equal(it.Key(), buf[:])
|
||||
v := binary.BigEndian.Uint32(it.Value())
|
||||
|
|
@ -569,7 +589,7 @@ func checkConsist(t *testing.T, p1 *MemDB, p2 *leveldb.DB) {
|
|||
assert.Equal(it.Value(), it2.Value())
|
||||
|
||||
if prevKey != nil {
|
||||
it, _ = p1.IterReverse(it2.Key())
|
||||
it, _ = p1.IterReverse(it2.Key(), nil)
|
||||
assert.Equal(it.Key(), prevKey)
|
||||
assert.Equal(it.Value(), prevVal)
|
||||
}
|
||||
|
|
@ -579,7 +599,7 @@ func checkConsist(t *testing.T, p1 *MemDB, p2 *leveldb.DB) {
|
|||
prevVal = it2.Value()
|
||||
}
|
||||
|
||||
it1, _ = p1.IterReverse(nil)
|
||||
it1, _ = p1.IterReverse(nil, nil)
|
||||
for it2.Last(); it2.Valid(); it2.Prev() {
|
||||
assert.Equal(it1.Key(), it2.Key())
|
||||
assert.Equal(it1.Value(), it2.Value())
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ func (s *mockSnapshot) Iter(k []byte, upperBound []byte) (Iterator, error) {
|
|||
return s.store.Iter(k, upperBound)
|
||||
}
|
||||
|
||||
func (s *mockSnapshot) IterReverse(k []byte) (Iterator, error) {
|
||||
return s.store.IterReverse(k)
|
||||
func (s *mockSnapshot) IterReverse(k, lowerBound []byte) (Iterator, error) {
|
||||
return s.store.IterReverse(k, lowerBound)
|
||||
}
|
||||
|
||||
func (s *mockSnapshot) SetOption(opt int, val interface{}) {}
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ type uSnapshot interface {
|
|||
// IterReverse creates a reversed Iterator positioned on the first entry which key is less than k.
|
||||
// The returned iterator will iterate from greater key to smaller key.
|
||||
// If k is nil, the returned iterator will be positioned at the last key.
|
||||
// TODO: Add lower bound limit
|
||||
IterReverse(k []byte) (Iterator, error)
|
||||
// It yields only keys that >= lowerBound. If lowerBound is nil, it means the lowerBound is unbounded.
|
||||
IterReverse(k, lowerBound []byte) (Iterator, error)
|
||||
}
|
||||
|
||||
// KVUnionStore is an in-memory Store which contains a buffer for write and a
|
||||
|
|
@ -124,12 +124,12 @@ func (us *KVUnionStore) Iter(k, upperBound []byte) (Iterator, error) {
|
|||
}
|
||||
|
||||
// IterReverse implements the Retriever interface.
|
||||
func (us *KVUnionStore) IterReverse(k []byte) (Iterator, error) {
|
||||
bufferIt, err := us.memBuffer.IterReverse(k)
|
||||
func (us *KVUnionStore) IterReverse(k, lowerBound []byte) (Iterator, error) {
|
||||
bufferIt, err := us.memBuffer.IterReverse(k, lowerBound)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
retrieverIt, err := us.snapshot.IterReverse(k)
|
||||
retrieverIt, err := us.snapshot.IterReverse(k, lowerBound)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,25 +125,33 @@ func TestUnionStoreIterReverse(t *testing.T) {
|
|||
err = store.Set([]byte("3"), []byte("3"))
|
||||
assert.Nil(err)
|
||||
|
||||
iter, err := us.IterReverse(nil)
|
||||
iter, err := us.IterReverse(nil, nil)
|
||||
assert.Nil(err)
|
||||
checkIterator(t, iter, [][]byte{[]byte("3"), []byte("2"), []byte("1")}, [][]byte{[]byte("3"), []byte("2"), []byte("1")})
|
||||
|
||||
iter, err = us.IterReverse([]byte("3"))
|
||||
iter, err = us.IterReverse([]byte("3"), []byte("1"))
|
||||
assert.Nil(err)
|
||||
checkIterator(t, iter, [][]byte{[]byte("2"), []byte("1")}, [][]byte{[]byte("2"), []byte("1")})
|
||||
|
||||
iter, err = us.IterReverse([]byte("3"), nil)
|
||||
assert.Nil(err)
|
||||
checkIterator(t, iter, [][]byte{[]byte("2"), []byte("1")}, [][]byte{[]byte("2"), []byte("1")})
|
||||
|
||||
err = us.GetMemBuffer().Set([]byte("0"), []byte("0"))
|
||||
assert.Nil(err)
|
||||
iter, err = us.IterReverse([]byte("3"))
|
||||
iter, err = us.IterReverse([]byte("3"), nil)
|
||||
assert.Nil(err)
|
||||
checkIterator(t, iter, [][]byte{[]byte("2"), []byte("1"), []byte("0")}, [][]byte{[]byte("2"), []byte("1"), []byte("0")})
|
||||
|
||||
err = us.GetMemBuffer().Delete([]byte("1"))
|
||||
assert.Nil(err)
|
||||
iter, err = us.IterReverse([]byte("3"))
|
||||
iter, err = us.IterReverse([]byte("3"), nil)
|
||||
assert.Nil(err)
|
||||
checkIterator(t, iter, [][]byte{[]byte("2"), []byte("0")}, [][]byte{[]byte("2"), []byte("0")})
|
||||
|
||||
iter, err = us.IterReverse([]byte("3"), []byte("1"))
|
||||
assert.Nil(err)
|
||||
checkIterator(t, iter, [][]byte{[]byte("2")}, [][]byte{[]byte("2")})
|
||||
}
|
||||
|
||||
func checkIterator(t *testing.T, iter Iterator, keys [][]byte, values [][]byte) {
|
||||
|
|
|
|||
|
|
@ -550,7 +550,8 @@ func (c *Client) Scan(ctx context.Context, startKey, endKey []byte, limit int, o
|
|||
return
|
||||
}
|
||||
|
||||
// ReverseScan queries continuous kv pairs in range [endKey, startKey), up to limit pairs.
|
||||
// ReverseScan queries continuous kv pairs in range [endKey, startKey),
|
||||
// from startKey(upperBound) to endKey(lowerBound), up to limit pairs.
|
||||
// The returned keys are in reversed lexicographical order.
|
||||
// If endKey is empty, it means unbounded.
|
||||
// If you want to include the startKey or exclude the endKey, push a '\0' to the key. For example, to scan
|
||||
|
|
|
|||
|
|
@ -247,8 +247,8 @@ func (txn *KVTxn) Iter(k []byte, upperBound []byte) (unionstore.Iterator, error)
|
|||
}
|
||||
|
||||
// IterReverse creates a reversed Iterator positioned on the first entry which key is less than k.
|
||||
func (txn *KVTxn) IterReverse(k []byte) (unionstore.Iterator, error) {
|
||||
return txn.us.IterReverse(k)
|
||||
func (txn *KVTxn) IterReverse(k, lowerBound []byte) (unionstore.Iterator, error) {
|
||||
return txn.us.IterReverse(k, lowerBound)
|
||||
}
|
||||
|
||||
// Delete removes the entry for key k from kv store.
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ func (s *Scanner) Next() error {
|
|||
}
|
||||
|
||||
current := s.cache[s.idx]
|
||||
if (!s.reverse && (len(s.endKey) > 0 && kv.CmpKey(current.Key, s.endKey) >= 0)) ||
|
||||
if (!s.reverse && len(s.endKey) > 0 && kv.CmpKey(current.Key, s.endKey) >= 0) ||
|
||||
(s.reverse && len(s.nextStartKey) > 0 && kv.CmpKey(current.Key, s.nextStartKey) < 0) {
|
||||
s.eof = true
|
||||
s.Close()
|
||||
|
|
|
|||
|
|
@ -771,8 +771,8 @@ func (s *KVSnapshot) Iter(k []byte, upperBound []byte) (unionstore.Iterator, err
|
|||
}
|
||||
|
||||
// IterReverse creates a reversed Iterator positioned on the first entry which key is less than k.
|
||||
func (s *KVSnapshot) IterReverse(k []byte) (unionstore.Iterator, error) {
|
||||
scanner, err := newScanner(s, nil, k, s.scanBatchSize, true)
|
||||
func (s *KVSnapshot) IterReverse(k, lowerBound []byte) (unionstore.Iterator, error) {
|
||||
scanner, err := newScanner(s, lowerBound, k, s.scanBatchSize, true)
|
||||
return scanner, err
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue