通过前面多篇文章,nsqlookupd基本已经解读完毕了,不过在关于channel和topic的增删上还比较模糊,所以本篇将站在宏观的角度来总结一下,tcp.go和http.go两个文件中关于channel和topic的操作有哪些。
总结如下表:
| 模块 | 文件 | 所在方法名 | 调用方法 | Registration | ||
| Category | Key | SubKey | ||||
| TCP | lookup_protocol_v1.go | REGISTER | AddProducer | “channel” | topic | channel | 
| AddProducer | “topic” | topic | “” | |||
| UNREGISTER | RemoveProducer | “channel” | topic | channel | ||
| RemoveProducer | “channel” | topic | “*” | |||
| RemoveProducer | “topic” | topic | “” | |||
| IDENTIFY | AddProducer | “client” | “” | “” | ||
| HTTP | http.go | topicsHandler | FindRegistrations | “topic” | “*” | “” | 
| channelsHandler | FindRegistrations | “channel” | topicName | “*” | ||
| lookupHandler | FindRegistrations | “channel” | topicName | “*” | ||
| FindRegistrations | “topic” | topicName | “” | |||
| createTopicHandler | AddRegistration | “topic” | topicName | “” | ||
| deleteTopicHandler | RemoveRegistration | “channel” | topicName | “*” | ||
| RemoveRegistration | “topic” | topicName | “” | |||
| tombstoneTopicProducerHandler | FindProducers | “topic” | topicName | “” | ||
| createChannelHandler | AddRegistration | “channel” | topicName | channelName | ||
| AddRegistration | “topic” | topicName | “” | |||
| deleteChannelHandler | RemoveRegistration | “channel” | topicName | channelName | ||
| nodesHandler | FindProducers | “client” | “” | “” | ||
| LookupRegistrations | “topic” | “*” | “” | |||
| FindProducers | “topic” | t | “” | |||