Skip to content

Commit

Permalink
change KeyspaceID to Keyspace
Browse files Browse the repository at this point in the history
Signed-off-by: iosmanthus <[email protected]>
  • Loading branch information
iosmanthus committed Aug 9, 2022
1 parent 20dd579 commit 6978bb5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
8 changes: 4 additions & 4 deletions internal/apicodec/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
// Mode represents the operation mode of a request.
type Mode int

// KeyspaceID represents a keyspace ID.
type KeyspaceID []byte
// Keyspace represents a keyspace prefix.
type Keyspace []byte

const (
// ModeRaw represent a raw operation in TiKV
Expand All @@ -22,8 +22,8 @@ const (
type Codec interface {
// GetAPIVersion returns the api version of the codec.
GetAPIVersion() kvrpcpb.APIVersion
// GetKeyspaceID returns the keyspace ID of the codec.
GetKeyspaceID() KeyspaceID
// GetKeyspace returns the keyspace ID of the codec.
GetKeyspace() Keyspace
// EncodeRequest encodes with the given Codec.
// NOTE: req is reused on retry. MUST encode on cloned request, other than overwrite the original.
EncodeRequest(req *tikvrpc.Request) (*tikvrpc.Request, error)
Expand Down
2 changes: 1 addition & 1 deletion internal/apicodec/codec_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (c *codecV1) GetAPIVersion() kvrpcpb.APIVersion {
return kvrpcpb.APIVersion_V1
}

func (c *codecV1) GetKeyspaceID() KeyspaceID {
func (c *codecV1) GetKeyspace() Keyspace {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/apicodec/codec_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (c *codecV2) GetAPIVersion() kvrpcpb.APIVersion {
return kvrpcpb.APIVersion_V2
}

func (c *codecV2) GetKeyspaceID() KeyspaceID {
func (c *codecV2) GetKeyspace() Keyspace {
return c.prefix
}

Expand Down
6 changes: 6 additions & 0 deletions tikv/region.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ type RPCRuntimeStats = locate.RPCRuntimeStats
// NewCodecPDClient is a constructor for CodecPDClient
var NewCodecPDClient = locate.NewCodecPDClient

// NewCodecPDClientWithKeyspace is a constructor for CodecPDClient with a keyspace name
var NewCodecPDClientWithKeyspace = locate.NewCodecPDClientWithKeyspace

// NewCodecV1 is a constructor for v1 Codec.
var NewCodecV1 = apicodec.NewCodecV1

Expand All @@ -104,6 +107,9 @@ type Codec = apicodec.Codec
// DefaultKeyspaceID is the keyspaceID of the default keyspace.
var DefaultKeyspaceID = apicodec.DefaultKeyspaceID

// Keyspace represents a keyspace prefix.
type Keyspace = apicodec.Keyspace

// Mode represents the operation mode of a request, export client.Mode
type Mode = apicodec.Mode

Expand Down

0 comments on commit 6978bb5

Please sign in to comment.