MCPcopy
hub / github.com/grpc/grpc-go / RegisterServer

Function RegisterServer

internal/channelz/funcs.go:168–182  ·  internal/channelz/funcs.go::RegisterServer

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.

(ref string)

Source from the content-addressed store, hash-verified

166//
167// If channelz is not turned ON, the channelz database is not mutated.
168func RegisterServer(ref string) *Server {
169 id := IDGen.genID()
170 if !IsOn() {
171 return &Server{ID: id}
172 }
173
174 svr := &Server{
175 RefName: ref,
176 sockets: make(map[int64]string),
177 listenSockets: make(map[int64]string),
178 ID: id,
179 }
180 db.addServer(id, svr)
181 return svr
182}
183
184// RegisterSocket registers the given normal socket s in channelz database
185// with ref as its reference name, and adds it to the child list of its parent

Callers 8

NewServerFunction · 0.92
newTestServerFunction · 0.92
TestGetServersMethod · 0.92
TestGetServerSocketsMethod · 0.92
TestGetSocketMethod · 0.92
TestGetSocketOptionsMethod · 0.92

Calls 3

IsOnFunction · 0.85
genIDMethod · 0.80
addServerMethod · 0.80

Tested by 7

newTestServerFunction · 0.74
TestGetServersMethod · 0.74
TestGetServerSocketsMethod · 0.74
TestGetSocketMethod · 0.74
TestGetSocketOptionsMethod · 0.74