var IDGen … var db … var EntriesPerPage … var curState … // TurnOn turns on channelz data collection. func TurnOn() { … } func init() { … } // IsOn returns whether channelz data collection is on. func IsOn() bool { … } // GetTopChannels returns a slice of top channel's ChannelMetric, along with a // boolean indicating whether there's more top channels to be queried for. // // The arg id specifies that only top channel with id at or above it will be // included in the result. The returned slice is up to a length of the arg // maxResults or EntriesPerPage if maxResults is zero, and is sorted in ascending // id order. func GetTopChannels(id int64, maxResults int) ([]*Channel, bool) { … } // GetServers returns a slice of server's ServerMetric, along with a // boolean indicating whether there's more servers to be queried for. // // The arg id specifies that only server with id at or above it will be included // in the result. The returned slice is up to a length of the arg maxResults or // EntriesPerPage if maxResults is zero, and is sorted in ascending id order. func GetServers(id int64, maxResults int) ([]*Server, bool) { … } // GetServerSockets returns a slice of server's (identified by id) normal socket's // SocketMetrics, along with a boolean indicating whether there's more sockets to // be queried for. // // The arg startID specifies that only sockets with id at or above it will be // included in the result. The returned slice is up to a length of the arg maxResults // or EntriesPerPage if maxResults is zero, and is sorted in ascending id order. func GetServerSockets(id int64, startID int64, maxResults int) ([]*Socket, bool) { … } // GetChannel returns the Channel for the channel (identified by id). func GetChannel(id int64) *Channel { … } // GetSubChannel returns the SubChannel for the subchannel (identified by id). func GetSubChannel(id int64) *SubChannel { … } // GetSocket returns the Socket for the socket (identified by id). func GetSocket(id int64) *Socket { … } // GetServer returns the ServerMetric for the server (identified by id). func GetServer(id int64) *Server { … } // RegisterChannel registers the given channel c in the channelz database with // target as its target and reference name, and adds it to the child list of its // parent. parent == nil means no parent. // // Returns a unique channelz identifier assigned to this channel. // // If channelz is not turned ON, the channelz database is not mutated. func RegisterChannel(parent *Channel, target string) *Channel { … } // RegisterSubChannel registers the given subChannel c in the channelz database // with ref as its reference name, and adds it to the child list of its parent // (identified by pid). // // Returns a unique channelz identifier assigned to this subChannel. // // If channelz is not turned ON, the channelz database is not mutated. func RegisterSubChannel(parent *Channel, ref string) *SubChannel { … } // RegisterServer registers the given server s in channelz database. It returns // the unique channelz tracking id assigned to this server. // // If channelz is not turned ON, the channelz database is not mutated. func RegisterServer(ref string) *Server { … } // RegisterSocket registers the given normal socket s in channelz database // with ref as its reference name, and adds it to the child list of its parent // (identified by skt.Parent, which must be set). It returns the unique channelz // tracking id assigned to this normal socket. // // If channelz is not turned ON, the channelz database is not mutated. func RegisterSocket(skt *Socket) *Socket { … } // RemoveEntry removes an entry with unique channelz tracking id to be id from // channelz database. // // If channelz is not turned ON, this function is a no-op. func RemoveEntry(id int64) { … } type IDGenerator … // Reset resets the generated ID back to zero. Should only be used at // initialization or by tests sensitive to the ID number. func (i *IDGenerator) Reset() { … } func (i *IDGenerator) genID() int64 { … } type Identifier …