zoukankan      html  css  js  c++  java
  • nsq源码阅读2_核心数据结构

    nsq源码阅读2_核心数据结构

    type RegistrationDB struct {
    	sync.RWMutex
    	registrationMap map[Registration]ProducerMap
    }
    
    type Registration struct {
    	Category string
    	Key      string
    	SubKey   string
    }
    type Registrations []Registration
    
    type PeerInfo struct {
    	lastUpdate       int64
    	id               string
    	RemoteAddress    string `json:"remote_address"`
    	Hostname         string `json:"hostname"`
    	BroadcastAddress string `json:"broadcast_address"`
    	TCPPort          int    `json:"tcp_port"`
    	HTTPPort         int    `json:"http_port"`
    	Version          string `json:"version"`
    }
    
    type Producer struct {
    	peerInfo     *PeerInfo
    	tombstoned   bool
    	tombstonedAt time.Time
    }
    
    type Producers []*Producer
    type ProducerMap map[string]*Producer
    

    从里面的数据结构可以看出来,这类似于etcd注册中心,只是简单的维护tcp连接信息,下面我们去看nsqd源码

  • 相关阅读:
    MSSQL数据库 事务隔离级别
    CSS(Cascading Style Shee)
    Winform MD5
    Winform 基础
    ASP.NET 设置DropDownList的当前选项
    如何彻底关闭退出vmware虚拟机
    Winform GDI+
    SQL优化
    登录
    Spring AOP的应用
  • 原文地址:https://www.cnblogs.com/maomaomaoge/p/15344578.html
Copyright © 2011-2022 走看看