Skip to content

Commit

Permalink
refactor: update interface of ClusterMetadataPayload
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-gang committed Sep 20, 2024
1 parent 5cc0bf1 commit 4d60f38
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions protocol/api/cluster_metadata_payloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,37 @@ import (
)

//lint:ignore U1000, these are not used in the codebase currently
type ClusterMetadataPayload struct {
type ClusterMetadataRecordValue struct {
FrameVersion int8
Type int8
Version int8
Data ClusterMetadataPayloadDataRecord
Data []byte
}

type ClusterMetadataPayloadDataRecord interface {
isPayloadRecord()
func (v ClusterMetadataRecordValue) Encode() []byte {
return []byte{}
}

type BeginTransactionRecord struct {
type BeginTransactionRecordValue struct {
Name string
}

func (b *BeginTransactionRecord) isPayloadRecord() {}
func (b *BeginTransactionRecordValue) Encode() []byte {
encoder := encoder.RealEncoder{}
encoder.Init(make([]byte, 4096))

encoder.PutUVarint(1) // taggedFieldCount
// Encode all the fields

encodedData := encoder.Bytes()[:encoder.Offset()]

return ClusterMetadataRecordValue{
FrameVersion: 1,
Type: 0,
Version: 0,
Data: encodedData,
}.Encode()
}

type EndTransactionRecord struct {
}
Expand Down

0 comments on commit 4d60f38

Please sign in to comment.