You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

remoting.go 2.2 kB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package remoting
  18. import (
  19. "reflect"
  20. )
  21. type RemoteType byte
  22. type ServiceType byte
  23. const (
  24. RemoteTypeSofaRpc RemoteType = 2
  25. RemoteTypeDubbo RemoteType = 3
  26. RemoteTypeRestful RemoteType = 4
  27. RemoteTypeLocalService RemoteType = 5
  28. RemoteTypeHsf RemoteType = 8
  29. ServiceTypeReference ServiceType = 1
  30. ServiceTypeProvider ServiceType = 2
  31. )
  32. type RemotingDesc struct {
  33. /**
  34. * is referenc bean ?
  35. */
  36. isReference bool
  37. /**
  38. * rpc target bean, the service bean has this property
  39. */
  40. targetBean interface{}
  41. /**
  42. * the tcc interface tyep
  43. */
  44. interfaceClass reflect.Type
  45. /**
  46. * interface class name
  47. */
  48. interfaceClassName string
  49. /**
  50. * rpc uniqueId: hsf, dubbo's version, sofa-rpc's uniqueId
  51. */
  52. uniqueId string
  53. /**
  54. * dubbo/hsf 's group
  55. */
  56. group string
  57. /**
  58. * protocol: sofa-rpc, dubbo, injvm etc.
  59. */
  60. protocol RemoteType
  61. }
  62. type RemotingParser interface {
  63. isRemoting(bean interface{}, beanName string) (bool, error)
  64. /**
  65. * if it is reference bean ?
  66. */
  67. isReference(bean interface{}, beanName string) (bool, error)
  68. /**
  69. * if it is service bean ?
  70. */
  71. isService(bean interface{}, beanName string) (bool, error)
  72. /**
  73. * get the remoting bean info
  74. */
  75. getServiceDesc(bean interface{}, beanName string) (RemotingDesc, error)
  76. /**
  77. * the remoting protocol
  78. */
  79. getProtocol() RemoteType
  80. }

Go Implementation For Seata