Browse Source

fmt

pull/7231/head
chrislu 2 months ago
parent
commit
71b2615f4a
  1. 4
      weed/mq/kafka/schema/envelope.go
  2. 4
      weed/mq/kafka/schema/manager.go
  3. 2
      weed/mq/kafka/schema/manager_test.go
  4. 6
      weed/mq/kafka/schema/reconstruction_test.go

4
weed/mq/kafka/schema/envelope.go

@ -32,8 +32,8 @@ func (f Format) String() string {
type ConfluentEnvelope struct {
Format Format
SchemaID uint32
Indexes []int // For Protobuf nested message resolution
Payload []byte // The actual encoded data
Indexes []int // For Protobuf nested message resolution
Payload []byte // The actual encoded data
}
// ParseConfluentEnvelope parses a Confluent Schema Registry framed message

4
weed/mq/kafka/schema/manager.go

@ -16,9 +16,9 @@ type Manager struct {
registryClient *RegistryClient
// Decoder cache
avroDecoders map[uint32]*AvroDecoder // schema ID -> decoder
avroDecoders map[uint32]*AvroDecoder // schema ID -> decoder
protobufDecoders map[uint32]*ProtobufDecoder // schema ID -> decoder
decoderMu sync.RWMutex
decoderMu sync.RWMutex
// Configuration
config ManagerConfig

2
weed/mq/kafka/schema/manager_test.go

@ -308,7 +308,7 @@ func BenchmarkManager_DecodeMessage(b *testing.B) {
// Setup (similar to TestManager_DecodeMessage but simplified)
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
response := map[string]interface{}{
"schema": `{"type":"record","name":"User","fields":[{"name":"id","type":"int"}]}`,
"schema": `{"type":"record","name":"User","fields":[{"name":"id","type":"int"}]}`,
"subject": "user-value",
"version": 1,
}

6
weed/mq/kafka/schema/reconstruction_test.go

@ -276,9 +276,9 @@ func TestSchemaMetadata_Preservation(t *testing.T) {
// Verify metadata contents
expectedMetadata := map[string]string{
"schema_format": "AVRO",
"schema_id": "42",
"protobuf_indexes": "1,2,3",
"schema_format": "AVRO",
"schema_id": "42",
"protobuf_indexes": "1,2,3",
}
for key, expectedValue := range expectedMetadata {

Loading…
Cancel
Save