| 1 | /* |
| 2 | * librdkafka - Apache Kafka C library |
| 3 | * |
| 4 | * Copyright (c) 2019 Magnus Edenhill |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions are met: |
| 9 | * |
| 10 | * 1. Redistributions of source code must retain the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 13 | * this list of conditions and the following disclaimer in the documentation |
| 14 | * and/or other materials provided with the distribution. |
| 15 | * PRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 24 | * POSSIBILITY OF SUCH DAMAGE. |
| 25 | */ |
| 26 | |
| 27 | #ifndef _RDKAFKA_MSGBATCH_H_ |
| 28 | #define _RDKAFKA_MSGBATCH_H_ |
| 29 | |
| 30 | typedef struct rd_kafka_msgbatch_s { |
| 31 | shptr_rd_kafka_toppar_t *s_rktp; /**< Reference to partition */ |
| 32 | |
| 33 | rd_kafka_msgq_t msgq; /**< Messages in batch */ |
| 34 | |
| 35 | /* Following fields are for Idempotent Producer use */ |
| 36 | rd_kafka_pid_t pid; /**< Producer Id and Epoch */ |
| 37 | int32_t first_seq; /**< Base sequence */ |
| 38 | int64_t first_msgid; /**< Base msgid */ |
| 39 | uint64_t last_msgid; /**< Last message to add to batch. |
| 40 | * This is used when reconstructing |
| 41 | * batches for resends with |
| 42 | * the idempotent producer which |
| 43 | * require retries to have the |
| 44 | * exact same messages in them. */ |
| 45 | |
| 46 | } rd_kafka_msgbatch_t; |
| 47 | |
| 48 | |
| 49 | |
| 50 | /* defined in rdkafka_msg.c */ |
| 51 | void rd_kafka_msgbatch_destroy (rd_kafka_msgbatch_t *rkmb); |
| 52 | void rd_kafka_msgbatch_init (rd_kafka_msgbatch_t *rkmb, |
| 53 | rd_kafka_toppar_t *rktp, |
| 54 | rd_kafka_pid_t pid); |
| 55 | void rd_kafka_msgbatch_set_first_msg (rd_kafka_msgbatch_t *rkmb, |
| 56 | rd_kafka_msg_t *rkm); |
| 57 | void rd_kafka_msgbatch_ready_produce (rd_kafka_msgbatch_t *rkmb); |
| 58 | |
| 59 | #endif /* _RDKAFKA_MSGBATCH_H_ */ |
| 60 | |