Add enum for TopicPartition offsets

This commit is contained in:
Matias Fontanini
2016-06-15 07:32:22 -07:00
parent 74eb74785d
commit 6877c4be03
2 changed files with 11 additions and 0 deletions

View File

@@ -40,6 +40,16 @@ namespace cppkafka {
*/
class TopicPartition {
public:
/**
* Special offsets enum
*/
enum Offset {
OFFSET_BEGINNING = -2,
OFFSET_END = -1,
OFFSET_STORED = -1000,
OFFSET_INVALID = -1001
};
/**
* Default constructs a topic/partition
*/

View File

@@ -13,6 +13,7 @@ TEST_F(TopicPartitionListTest, Conversion) {
TopicPartitionList list1;
list1.push_back("foo");
list1.push_back({ "bar", 2 });
list1.push_back({ "asd", 2, TopicPartition::OFFSET_BEGINNING });
TopicPartitionList list2 = convert(convert(list1));