khenaidoo | ac63710 | 2019-01-14 15:44:34 -0500 | [diff] [blame^] | 1 | /** |
| 2 | * Copyright 2016 Confluent Inc. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | #pragma once |
| 17 | |
| 18 | |
| 19 | /** |
| 20 | * Glue between Go, Cgo and librdkafka |
| 21 | */ |
| 22 | |
| 23 | |
| 24 | /** |
| 25 | * Temporary C to Go header representation |
| 26 | */ |
| 27 | typedef struct tmphdr_s { |
| 28 | const char *key; |
| 29 | const void *val; // producer: malloc()ed by Go code if size > 0 |
| 30 | // consumer: owned by librdkafka |
| 31 | ssize_t size; |
| 32 | } tmphdr_t; |
| 33 | |
| 34 | |
| 35 | |
| 36 | /** |
| 37 | * Represents a fetched C message, with all extra fields extracted |
| 38 | * to struct fields. |
| 39 | */ |
| 40 | typedef struct fetched_c_msg { |
| 41 | rd_kafka_message_t *msg; |
| 42 | rd_kafka_timestamp_type_t tstype; |
| 43 | int64_t ts; |
| 44 | tmphdr_t *tmphdrs; |
| 45 | size_t tmphdrsCnt; |
| 46 | } fetched_c_msg_t; |