diff options
Diffstat (limited to 'test/kafka/kafka-client-loadtest/internal/schema')
3 files changed, 259 insertions, 0 deletions
diff --git a/test/kafka/kafka-client-loadtest/internal/schema/loadtest.proto b/test/kafka/kafka-client-loadtest/internal/schema/loadtest.proto new file mode 100644 index 000000000..dfe00b72f --- /dev/null +++ b/test/kafka/kafka-client-loadtest/internal/schema/loadtest.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; + +package com.seaweedfs.loadtest; + +option go_package = "github.com/seaweedfs/seaweedfs/test/kafka/kafka-client-loadtest/internal/schema/pb"; + +message LoadTestMessage { + string id = 1; + int64 timestamp = 2; + int32 producer_id = 3; + int64 counter = 4; + string user_id = 5; + string event_type = 6; + map<string, string> properties = 7; +} + diff --git a/test/kafka/kafka-client-loadtest/internal/schema/pb/loadtest.pb.go b/test/kafka/kafka-client-loadtest/internal/schema/pb/loadtest.pb.go new file mode 100644 index 000000000..3ed58aa9e --- /dev/null +++ b/test/kafka/kafka-client-loadtest/internal/schema/pb/loadtest.pb.go @@ -0,0 +1,185 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc v5.29.3 +// source: loadtest.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type LoadTestMessage struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + ProducerId int32 `protobuf:"varint,3,opt,name=producer_id,json=producerId,proto3" json:"producer_id,omitempty"` + Counter int64 `protobuf:"varint,4,opt,name=counter,proto3" json:"counter,omitempty"` + UserId string `protobuf:"bytes,5,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + EventType string `protobuf:"bytes,6,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` + Properties map[string]string `protobuf:"bytes,7,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoadTestMessage) Reset() { + *x = LoadTestMessage{} + mi := &file_loadtest_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoadTestMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoadTestMessage) ProtoMessage() {} + +func (x *LoadTestMessage) ProtoReflect() protoreflect.Message { + mi := &file_loadtest_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoadTestMessage.ProtoReflect.Descriptor instead. +func (*LoadTestMessage) Descriptor() ([]byte, []int) { + return file_loadtest_proto_rawDescGZIP(), []int{0} +} + +func (x *LoadTestMessage) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *LoadTestMessage) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *LoadTestMessage) GetProducerId() int32 { + if x != nil { + return x.ProducerId + } + return 0 +} + +func (x *LoadTestMessage) GetCounter() int64 { + if x != nil { + return x.Counter + } + return 0 +} + +func (x *LoadTestMessage) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *LoadTestMessage) GetEventType() string { + if x != nil { + return x.EventType + } + return "" +} + +func (x *LoadTestMessage) GetProperties() map[string]string { + if x != nil { + return x.Properties + } + return nil +} + +var File_loadtest_proto protoreflect.FileDescriptor + +const file_loadtest_proto_rawDesc = "" + + "\n" + + "\x0eloadtest.proto\x12\x16com.seaweedfs.loadtest\"\xca\x02\n" + + "\x0fLoadTestMessage\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1c\n" + + "\ttimestamp\x18\x02 \x01(\x03R\ttimestamp\x12\x1f\n" + + "\vproducer_id\x18\x03 \x01(\x05R\n" + + "producerId\x12\x18\n" + + "\acounter\x18\x04 \x01(\x03R\acounter\x12\x17\n" + + "\auser_id\x18\x05 \x01(\tR\x06userId\x12\x1d\n" + + "\n" + + "event_type\x18\x06 \x01(\tR\teventType\x12W\n" + + "\n" + + "properties\x18\a \x03(\v27.com.seaweedfs.loadtest.LoadTestMessage.PropertiesEntryR\n" + + "properties\x1a=\n" + + "\x0fPropertiesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01BTZRgithub.com/seaweedfs/seaweedfs/test/kafka/kafka-client-loadtest/internal/schema/pbb\x06proto3" + +var ( + file_loadtest_proto_rawDescOnce sync.Once + file_loadtest_proto_rawDescData []byte +) + +func file_loadtest_proto_rawDescGZIP() []byte { + file_loadtest_proto_rawDescOnce.Do(func() { + file_loadtest_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_loadtest_proto_rawDesc), len(file_loadtest_proto_rawDesc))) + }) + return file_loadtest_proto_rawDescData +} + +var file_loadtest_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_loadtest_proto_goTypes = []any{ + (*LoadTestMessage)(nil), // 0: com.seaweedfs.loadtest.LoadTestMessage + nil, // 1: com.seaweedfs.loadtest.LoadTestMessage.PropertiesEntry +} +var file_loadtest_proto_depIdxs = []int32{ + 1, // 0: com.seaweedfs.loadtest.LoadTestMessage.properties:type_name -> com.seaweedfs.loadtest.LoadTestMessage.PropertiesEntry + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_loadtest_proto_init() } +func file_loadtest_proto_init() { + if File_loadtest_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_loadtest_proto_rawDesc), len(file_loadtest_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_loadtest_proto_goTypes, + DependencyIndexes: file_loadtest_proto_depIdxs, + MessageInfos: file_loadtest_proto_msgTypes, + }.Build() + File_loadtest_proto = out.File + file_loadtest_proto_goTypes = nil + file_loadtest_proto_depIdxs = nil +} diff --git a/test/kafka/kafka-client-loadtest/internal/schema/schemas.go b/test/kafka/kafka-client-loadtest/internal/schema/schemas.go new file mode 100644 index 000000000..011b28ef2 --- /dev/null +++ b/test/kafka/kafka-client-loadtest/internal/schema/schemas.go @@ -0,0 +1,58 @@ +package schema + +// GetAvroSchema returns the Avro schema for load test messages +func GetAvroSchema() string { + return `{ + "type": "record", + "name": "LoadTestMessage", + "namespace": "com.seaweedfs.loadtest", + "fields": [ + {"name": "id", "type": "string"}, + {"name": "timestamp", "type": "long"}, + {"name": "producer_id", "type": "int"}, + {"name": "counter", "type": "long"}, + {"name": "user_id", "type": "string"}, + {"name": "event_type", "type": "string"}, + {"name": "properties", "type": {"type": "map", "values": "string"}} + ] + }` +} + +// GetJSONSchema returns the JSON Schema for load test messages +func GetJSONSchema() string { + return `{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "LoadTestMessage", + "type": "object", + "properties": { + "id": {"type": "string"}, + "timestamp": {"type": "integer"}, + "producer_id": {"type": "integer"}, + "counter": {"type": "integer"}, + "user_id": {"type": "string"}, + "event_type": {"type": "string"}, + "properties": { + "type": "object", + "additionalProperties": {"type": "string"} + } + }, + "required": ["id", "timestamp", "producer_id", "counter", "user_id", "event_type"] + }` +} + +// GetProtobufSchema returns the Protobuf schema for load test messages +func GetProtobufSchema() string { + return `syntax = "proto3"; + +package com.seaweedfs.loadtest; + +message LoadTestMessage { + string id = 1; + int64 timestamp = 2; + int32 producer_id = 3; + int64 counter = 4; + string user_id = 5; + string event_type = 6; + map<string, string> properties = 7; +}` +} |
