From d8e323c7119370bac72744ec65af24630d89617f Mon Sep 17 00:00:00 2001 From: yangxiaodong Date: Fri, 12 May 2017 16:55:16 +0800 Subject: [PATCH] refactor. --- .../Internal/QMessageFinder.cs | 43 ------------------- .../Internal/QMessageMethodInfo.cs | 36 ---------------- 2 files changed, 79 deletions(-) delete mode 100644 src/Cap.Consistency/Internal/QMessageFinder.cs delete mode 100644 src/Cap.Consistency/Internal/QMessageMethodInfo.cs diff --git a/src/Cap.Consistency/Internal/QMessageFinder.cs b/src/Cap.Consistency/Internal/QMessageFinder.cs deleted file mode 100644 index 363bbdf..0000000 --- a/src/Cap.Consistency/Internal/QMessageFinder.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Threading.Tasks; -using System.Collections.Concurrent; -using Cap.Consistency.Extensions; -using Cap.Consistency.Abstractions; - -namespace Cap.Consistency -{ - public class QMessageFinder - { - public ConcurrentDictionary GetQMessageMethodInfo(params Type[] serviceType) { - - var qMessageTypes = new ConcurrentDictionary(); - - foreach (var type in serviceType) { - - foreach (var method in type.GetTypeInfo().DeclaredMethods) { - - var messageMethodInfo = new ConsumerExecutorDescriptor(); - - if (method.IsPropertyBinding()) { - continue; - } - - var qMessageAttr = method.GetCustomAttribute(); - if (qMessageAttr == null) { - continue; - } - - messageMethodInfo.ImplType = method.DeclaringType; - messageMethodInfo.MethodInfo = method; - - qMessageTypes.AddOrUpdate(qMessageAttr.MessageName, messageMethodInfo, (x, y) => y); - } - } - - return qMessageTypes; - } - } -} diff --git a/src/Cap.Consistency/Internal/QMessageMethodInfo.cs b/src/Cap.Consistency/Internal/QMessageMethodInfo.cs deleted file mode 100644 index 07ffbbd..0000000 --- a/src/Cap.Consistency/Internal/QMessageMethodInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -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; - } - - } -}