Skip to content

Commit cf27855

Browse files
committed
fix(encryption): make tikv meta client self-contained
Signed-off-by: tenfyzhong <tenfy@tenfy.cn>
1 parent 2802c4f commit cf27855

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/encryption/tikv_http_client.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ type tikvEncryptionHTTPClient struct {
4141
httpTimeout time.Duration
4242
}
4343

44+
// TiKVEncryptionClient fetches keyspace-level encryption metadata from TiKV.
45+
// It is consumed by the encryption meta manager in follow-up PRs.
46+
type TiKVEncryptionClient interface {
47+
GetKeyspaceEncryptionMeta(ctx context.Context, keyspaceID uint32) (*EncryptionMeta, error)
48+
}
49+
4450
func NewTiKVEncryptionHTTPClient(pdClient pd.Client, credential *security.Credential) (TiKVEncryptionClient, error) {
4551
httpClient, err := httputil.NewClient(credential)
4652
if err != nil {
@@ -420,3 +426,17 @@ func truncateBytesForLog(b []byte, max int) string {
420426
}
421427
return fmt.Sprintf("%s...(truncated, %d bytes total)", string(b[:max]), len(b))
422428
}
429+
430+
func safeKMSVendor(masterKey *MasterKey) string {
431+
if masterKey == nil {
432+
return ""
433+
}
434+
return masterKey.Vendor
435+
}
436+
437+
func safeCMEKID(masterKey *MasterKey) string {
438+
if masterKey == nil {
439+
return ""
440+
}
441+
return masterKey.CmekId
442+
}

0 commit comments

Comments
 (0)