type Channel … // Implemented to make Channel implement the Identifier interface used for // nesting. func (c *Channel) channelzIdentifier() { … } func (c *Channel) String() string { … } func (c *Channel) id() int64 { … } func (c *Channel) SubChans() map[int64]string { … } func (c *Channel) NestedChans() map[int64]string { … } func (c *Channel) Trace() *ChannelTrace { … } type ChannelMetrics … // CopyFrom copies the metrics in o to c. For testing only. func (c *ChannelMetrics) CopyFrom(o *ChannelMetrics) { … } // Equal returns true iff the metrics of c are the same as the metrics of o. // For testing only. func (c *ChannelMetrics) Equal(o any) bool { … } func strFromPointer(s *string) string { … } func (c *ChannelMetrics) String() string { … } func NewChannelMetricForTesting(state connectivity.State, target string, started, succeeded, failed, timestamp int64) *ChannelMetrics { … } func (c *Channel) addChild(id int64, e entry) { … } func (c *Channel) deleteChild(id int64) { … } func (c *Channel) triggerDelete() { … } func (c *Channel) getParentID() int64 { … } // deleteSelfFromTree tries to delete the channel from the channelz entry relation tree, which means // deleting the channel reference from its parent's child list. // // In order for a channel to be deleted from the tree, it must meet the criteria that, removal of the // corresponding grpc object has been invoked, and the channel does not have any children left. // // The returned boolean value indicates whether the channel has been successfully deleted from tree. func (c *Channel) deleteSelfFromTree() (deleted bool) { … } // deleteSelfFromMap checks whether it is valid to delete the channel from the map, which means // deleting the channel from channelz's tracking entirely. Users can no longer use id to query the // channel, and its memory will be garbage collected. // // The trace reference count of the channel must be 0 in order to be deleted from the map. This is // specified in the channel tracing gRFC that as long as some other trace has reference to an entity, // the trace of the referenced entity must not be deleted. In order to release the resource allocated // by grpc, the reference to the grpc object is reset to a dummy object. // // deleteSelfFromMap must be called after deleteSelfFromTree returns true. // // It returns a bool to indicate whether the channel can be safely deleted from map. func (c *Channel) deleteSelfFromMap() (delete bool) { … } // deleteSelfIfReady tries to delete the channel itself from the channelz database. // The delete process includes two steps: // 1. delete the channel from the entry relation tree, i.e. delete the channel reference from its // parent's child list. // 2. delete the channel from the map, i.e. delete the channel entirely from channelz. Lookup by id // will return entry not found error. func (c *Channel) deleteSelfIfReady() { … } func (c *Channel) getChannelTrace() *ChannelTrace { … } func (c *Channel) incrTraceRefCount() { … } func (c *Channel) decrTraceRefCount() { … } func (c *Channel) getTraceRefCount() int { … } func (c *Channel) getRefName() string { … }