func (sm *serviceMap) Register(interfaceName, protocol, group, version string, rcvr RPCService) (string, error) {
	if sm.serviceMap[protocol] == nil {
		sm.serviceMap[protocol] = make(map[string]*Service)
	}
	if sm.interfaceMap[interfaceName] == nil {
		sm.interfaceMap[interfaceName] = make([]*Service, 0, 16)
	}

	s := new(Service)
	s.rcvrType = reflect.TypeOf(rcvr)
	s.rcvr = reflect.ValueOf(rcvr)
	sname := reflect.Indirect(s.rcvr).Type().Name()
	if sname == "" {
		s := "no service name for type " + s.rcvrType.String()
		logger.Errorf(s)
		return "", perrors.New(s)
	}
	/*if !isExported(sname) {
		s := "type " + sname + " is not exported"
		logger.Errorf(s)
		return "", perrors.New(s)
	}*/

	sname = ServiceKey(interfaceName, group, version)
	if server := sm.GetService(protocol, interfaceName, group, version); server != nil {
		return "", perrors.New("service already defined: " + sname)
	}
	s.name = sname
	s.methods = make(map[string]*MethodType)

	// Install the methods
	methods := ""
	methods, s.methods = suitableMethods(s.rcvrType)

	if len(s.methods) == 0 {
		s := "type " + sname + " has no exported methods of suitable type"
		logger.Errorf(s)
		return "", perrors.New(s)
	}
	sm.mutex.Lock()
	sm.serviceMap[protocol][s.name] = s
	sm.interfaceMap[interfaceName] = append(sm.interfaceMap[interfaceName], s)
	sm.mutex.Unlock()

	return strings.TrimSuffix(methods, ","), nil
}
// Register registers a service by @interfaceName and @protocol
Register registers a service by @interfaceName and @protocol
// Register registers a service by @interfaceName and @protocol
func (sm *serviceMap) Register(interfaceName, protocol, group, version string, rcvr RPCService) (string, error) {
	if sm.serviceMap[protocol] == nil {
		sm.serviceMap[protocol] = make(map[string]*Service)
	}
	if sm.interfaceMap[interfaceName] == nil {
		sm.interfaceMap[interfaceName] = make([]*Service, 0, 16)
	}
	s := new(Service)
	s.rcvrType = reflect.TypeOf(rcvr)
	s.rcvr = reflect.ValueOf(rcvr)
	sname := reflect.Indirect(s.rcvr).Type().Name()
	if sname == "" {
		s := "no service name for type " + s.rcvrType.String()
		logger.Errorf(s)
		return "", perrors.New(s)
	}
	sname = ServiceKey(interfaceName, group, version)
	if server := sm.GetService(protocol, interfaceName, group, version); server != nil {
		return "", perrors.New("service already defined: " + sname)
	}
	s.name = sname
	s.methods = make(map[string]*MethodType)
	methods := ""
	methods, s.methods = suitableMethods(s.rcvrType)
	if len(s.methods) == 0 {
		s := "type " + sname + " has no exported methods of suitable type"
		logger.Errorf(s)
		return "", perrors.New(s)
	}
	sm.mutex.Lock()
	sm.serviceMap[protocol][s.name] = s
	sm.interfaceMap[interfaceName] = append(sm.interfaceMap[interfaceName], s)
	sm.mutex.Unlock()
	return strings.TrimSuffix(methods, ","), nil
}
func ( sm * serviceMap ) Register ( interfaceName , protocol , group , version string , rcvr RPCService ) ( string , error ) { if sm . serviceMap [ protocol ] == nil { sm . serviceMap [ protocol ] = make ( map [ string ] * Service ) } if sm . interfaceMap [ interfaceName ] == nil { sm . interfaceMap [ interfaceName ] = make ( [ ] * Service , 0 , 16 ) } s := new ( Service ) s . rcvrType = reflect . TypeOf ( rcvr ) s . rcvr = reflect . ValueOf ( rcvr ) sname := reflect . Indirect ( s . rcvr ) . Type ( ) . Name ( ) if sname == " " { s := " " + s . rcvrType . String ( ) logger . Errorf ( s ) return " " , perrors . New ( s ) } sname = ServiceKey ( interfaceName , group , version ) if server := sm . GetService ( protocol , interfaceName , group , version ) ; server != nil { return " " , perrors . New ( " " + sname ) } s . name = sname s . methods = make ( map [ string ] * MethodType ) methods := " " methods , s . methods = suitableMethods ( s . rcvrType ) if len ( s . methods ) == 0 { s := " " + sname + " " logger . Errorf ( s ) return " " , perrors . New ( s ) } sm . mutex . Lock ( ) sm . serviceMap [ protocol ] [ s . name ] = s sm . interfaceMap [ interfaceName ] = append ( sm . interfaceMap [ interfaceName ] , s ) sm . mutex . Unlock ( ) return strings . TrimSuffix ( methods , " " ) , nil }
Register registers a service by @interfaceName and @protocol
Register registers a service by @interfaceName and @protocol
/*if !isExported(sname) {
		s := "type " + sname + " is not exported"
		logger.Errorf(s)
		return "", perrors.New(s)
	}*/ // Install the methods