rawkv: split BatchPut and BatchPutTTL (#414)

Signed-off-by: disksing <i@disksing.com>
This commit is contained in:
disksing 2022-01-06 18:46:37 +08:00 committed by GitHub
parent fe2def20bb
commit 13298f12fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -113,7 +113,7 @@ func (s *testRawKVSuite) mustPut(key, value []byte) {
}
func (s *testRawKVSuite) mustBatchPut(keys, values [][]byte) {
err := s.client.BatchPut(context.Background(), keys, values, nil)
err := s.client.BatchPut(context.Background(), keys, values)
s.Nil(err)
}

View File

@ -240,7 +240,12 @@ func (c *Client) Put(ctx context.Context, key, value []byte) error {
}
// BatchPut stores key-value pairs to TiKV.
func (c *Client) BatchPut(ctx context.Context, keys, values [][]byte, ttls []uint64) error {
func (c *Client) BatchPut(ctx context.Context, keys, values [][]byte) error {
return c.BatchPutWithTTL(ctx, keys, values, nil)
}
// BatchPutWithTTL stores key-values pairs to TiKV with time-to-live durations.
func (c *Client) BatchPutWithTTL(ctx context.Context, keys, values [][]byte, ttls []uint64) error {
start := time.Now()
defer func() {
metrics.RawkvCmdHistogramWithBatchPut.Observe(time.Since(start).Seconds())