aboutsummaryrefslogtreecommitdiff
path: root/test/kafka/kafka-client-loadtest/internal/schema/schemas.go
blob: 011b28ef2ddcf12d01e90a9bec0bee4983e496ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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;
}`
}