// RegisterClient registers an incoming streamer constructor
339234
func (r *Registry) RegisterClientFunc(stream string, f func(*Peer, string, bool) (Client, error)) {
	r.clientMu.Lock()
	defer r.clientMu.Unlock()

	r.clientFuncs[stream] = f
}
703756
func (c *TowerClient) RegisterChannel(chanID lnwire.ChannelID) error {
	c.sweepPkScriptMu.Lock()
	defer c.sweepPkScriptMu.Unlock()

	// If a pkscript for this channel already exists, the channel has been
	// previously registered.
	if _, ok := c.sweepPkScripts[chanID]; ok {
		return nil
	}

	// Otherwise, generate a new sweep pkscript used to sweep funds for this
	// channel.
	pkScript, err := c.cfg.NewAddress()
	if err != nil {
		return err
	}

	// Persist the sweep pkscript so that restarts will not introduce
	// address inflation when the channel is reregistered after a restart.
	err = c.cfg.DB.AddChanPkScript(chanID, pkScript)
	if err != nil {
		return err
	}

	// Finally, cache the pkscript in our in-memory cache to avoid db
	// lookups for the remainder of the daemon's execution.
	c.sweepPkScripts[chanID] = pkScript

	return nil
}
163455
func Register(s *grpc.Server) {
	rpb.RegisterServerReflectionServer(s, &serverReflectionServer{
		s: s,
	})
}
465775
func (c *Conn) getClient() (*StreamClient, error) {
	// Check for cached client
	c.clientLock.Lock()
	front := c.clients.Front()
	if front != nil {
		c.clients.Remove(front)
	}
	c.clientLock.Unlock()
	if front != nil {
		return front.Value.(*StreamClient), nil
	}

	// Open a new session
	stream, err := c.session.Open()
	if err != nil {
		return nil, err
	}

	// Create the RPC client
	codec := msgpackrpc.NewClientCodec(stream)

	// Return a new stream client
	sc := &StreamClient{
		stream: stream,
		codec:  codec,
	}
	return sc, nil
}
949432
func registerService(objClient objdb.API, ctrlIP, vtepIP, hostname string, vxlanUDPPort int) error {
	// netplugin service info
	srvInfo := objdb.ServiceInfo{
		ServiceName: "netplugin",
		TTL:         10,
		HostAddr:    ctrlIP,
		Port:        netpluginRPCPort1,
		Hostname:    hostname,
	}

	// Register the node with service registry
	err := objClient.RegisterService(srvInfo)
	if err != nil {
		log.Fatalf("Error registering service. Err: %v", err)
		return err
	}

	srvInfo = objdb.ServiceInfo{
		ServiceName: "netplugin",
		TTL:         10,
		HostAddr:    ctrlIP,
		Port:        netpluginRPCPort2,
		Hostname:    hostname,
	}

	// Register the node with service registry
	err = objClient.RegisterService(srvInfo)
	if err != nil {
		log.Fatalf("Error registering service. Err: %v", err)
		return err
	}

	// netplugn VTEP service info
	srvInfo = objdb.ServiceInfo{
		ServiceName: "netplugin.vtep",
		TTL:         10,
		HostAddr:    vtepIP,
		Port:        vxlanUDPPort,
		Hostname:    hostname,
	}

	// Register the node with service registry
	err = objClient.RegisterService(srvInfo)
	if err != nil {
		log.Fatalf("Error registering service. Err: %v", err)
		return err
	}

	log.Infof("Registered netplugin service with registry")
	return nil
}
1222252
func (r *StreamRegistry) Register(streamInfo *Stream) {
	r.Lock()
	defer r.Unlock()

	r.ConnManager.TagPeer(streamInfo.peer, cmgrTag, 20)
	r.conns[streamInfo.peer]++

	streamInfo.id = r.nextID
	r.Streams[r.nextID] = streamInfo
	r.nextID++

	streamInfo.startStreaming()
}
753751
func (d *dispatcher) RegisterFunc(c StreamType, h HandlerFunc) {
	d.handlers[c] = &basicHandler{h}
}
947907
func (c *Client) RegisterStream(ctx context.Context, in *s.RegisterStreamRequest, opts ...grpc.CallOption) (
	*s.RegisterStreamResponse, error) {

	resp, err := c.bundleRPC(ctx, opts, &s.BatchRequest_Entry{
		Value: &s.BatchRequest_Entry_RegisterStream{RegisterStream: in},
	})
	if err != nil {
		return nil, err
	}

	return resp.GetRegisterStream(), nil
}
948938
func (r *Registry) RegisterServerFunc(stream string, f func(*Peer, string, bool) (Server, error)) {
	r.serverMu.Lock()
	defer r.serverMu.Unlock()

	r.serverFuncs[stream] = f
}
338433
func RegisterAccountServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
	return RegisterAccountServiceHandlerClient(ctx, mux, NewAccountServiceClient(conn))
}
1076602
func (c *Sys) RegisterPlugin(i *RegisterPluginInput) error {
	path := catalogPathByType(i.Type, i.Name)
	req := c.c.NewRequest(http.MethodPut, path)

	if err := req.SetJSONBody(i); err != nil {
		return err
	}

	ctx, cancelFunc := context.WithCancel(context.Background())
	defer cancelFunc()
	resp, err := c.c.RawRequestWithContext(ctx, req)
	if err == nil {
		defer resp.Body.Close()
	}
	return err
}
870507
func RegisterSettingsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
	return RegisterSettingsServiceHandlerClient(ctx, mux, NewSettingsServiceClient(conn))
}
650679
func (p Protos) RegisterProvider(rtype string) error {
	req, err := http.NewRequest("POST", p.createURL("provider/"+rtype), bytes.NewBuffer([]byte{}))
	if err != nil {
		return err
	}
	req.Header.Set("Content-Type", "application/json")

	_, err = p.makeRequest(req)
	if err != nil {
		return err
	}

	return nil
}
461302
func (r *Registry) NewClient(path string, namespace types.StreamName) (Client, error) {
	parts := strings.SplitN(path, ":", 2)
	value := ""
	if len(parts) == 2 {
		value = parts[1]
	}

	r.lock.Lock()
	defer r.lock.Unlock()

	if f, ok := r.protocols[parts[0]]; ok {
		return f(value, namespace)
	}
	return nil, fmt.Errorf("streamclient: no protocol registered for [%s]", parts[0])
}
798008
func (c *ApiregistrationClient) RESTClient() rest.Interface {
	if c == nil {
		return nil
	}
	return c.restClient
}
119196
func RegisterRepositoryServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
	return RegisterRepositoryServiceHandlerClient(ctx, mux, NewRepositoryServiceClient(conn))
}
819455
func (cs *clientStore) register(info *spb.ClientInfo) (*client, error) {
	cs.Lock()
	defer cs.Unlock()
	c := cs.clients[info.ID]
	if c != nil {
		return nil, ErrInvalidClient
	}
	sc, err := cs.store.AddClient(info)
	if err != nil {
		return nil, err
	}
	c = &client{info: sc, subs: make([]*subState, 0, 4)}
	cs.clients[c.info.ID] = c
	if len(c.info.ConnID) > 0 {
		cs.connIDs[string(c.info.ConnID)] = c
	}
	delete(cs.knownInvalid, getKnownInvalidKey(info.ID, info.ConnID))
	if cs.waitOnRegister != nil {
		ch := cs.waitOnRegister[c.info.ID]
		if ch != nil {
			ch <- struct{}{}
			delete(cs.waitOnRegister, c.info.ID)
		}
	}
	return c, nil
}