type SubChannel … func (sc *SubChannel) String() string { … } func (sc *SubChannel) id() int64 { … } func (sc *SubChannel) Sockets() map[int64]string { … } func (sc *SubChannel) Trace() *ChannelTrace { … } func (sc *SubChannel) addChild(id int64, e entry) { … } func (sc *SubChannel) deleteChild(id int64) { … } func (sc *SubChannel) triggerDelete() { … } func (sc *SubChannel) getParentID() int64 { … } // deleteSelfFromTree tries to delete the subchannel from the channelz entry relation tree, which // means deleting the subchannel reference from its parent's child list. // // In order for a subchannel to be deleted from the tree, it must meet the criteria that, removal of // the corresponding grpc object has been invoked, and the subchannel does not have any children left. // // The returned boolean value indicates whether the channel has been successfully deleted from tree. func (sc *SubChannel) deleteSelfFromTree() (deleted bool) { … } // deleteSelfFromMap checks whether it is valid to delete the subchannel from the map, which means // deleting the subchannel from channelz's tracking entirely. Users can no longer use id to query // the subchannel, and its memory will be garbage collected. // // The trace reference count of the subchannel 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 (sc *SubChannel) deleteSelfFromMap() (delete bool) { … } // deleteSelfIfReady tries to delete the subchannel itself from the channelz database. // The delete process includes two steps: // 1. delete the subchannel from the entry relation tree, i.e. delete the subchannel reference from // its parent's child list. // 2. delete the subchannel from the map, i.e. delete the subchannel entirely from channelz. Lookup // by id will return entry not found error. func (sc *SubChannel) deleteSelfIfReady() { … } func (sc *SubChannel) getChannelTrace() *ChannelTrace { … } func (sc *SubChannel) incrTraceRefCount() { … } func (sc *SubChannel) decrTraceRefCount() { … } func (sc *SubChannel) getTraceRefCount() int { … } func (sc *SubChannel) getRefName() string { … }