From 9362bc7dd9c332613f288ba830b6e203e3556042 Mon Sep 17 00:00:00 2001 From: yangxiaodong Date: Tue, 23 May 2017 16:58:58 +0800 Subject: [PATCH] refactor --- src/Cap.Consistency/Internal/TopicInfo.cs | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/Cap.Consistency/Internal/TopicInfo.cs diff --git a/src/Cap.Consistency/Internal/TopicInfo.cs b/src/Cap.Consistency/Internal/TopicInfo.cs new file mode 100644 index 0000000..07ffbbd --- /dev/null +++ b/src/Cap.Consistency/Internal/TopicInfo.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; + +namespace Cap.Consistency +{ + public class TopicInfo + { + public TopicInfo(string topicName) : this(topicName, 0) {} + + public TopicInfo(string topicName, int partition) : this(topicName, partition, 0) {} + + public TopicInfo(string topicName, int partition, long offset) { + Name = topicName; + Offset = offset; + Partition = partition; + } + + public string Name { get; } + + public int Partition { get; } + + public long Offset { get; } + + public bool IsPartition { get { return Partition == 0; } } + + public bool IsOffset { get { return Offset == 0; } } + + public override string ToString() { + return Name; + } + + } +}