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.

registry.go 1.1 kB

4 years ago
4 years ago
4 years ago
4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package file
  2. import (
  3. "strings"
  4. )
  5. import (
  6. "github.com/transaction-wg/seata-golang/pkg/base/constant"
  7. "github.com/transaction-wg/seata-golang/pkg/base/extension"
  8. "github.com/transaction-wg/seata-golang/pkg/base/registry"
  9. "github.com/transaction-wg/seata-golang/pkg/client/config"
  10. "github.com/transaction-wg/seata-golang/pkg/util/log"
  11. )
  12. func init() {
  13. extension.SetRegistry(constant.FileKey, newFileRegistry)
  14. }
  15. type fileRegistry struct {
  16. }
  17. func (nr *fileRegistry) Register(addr *registry.Address) error {
  18. log.Info("file register")
  19. return nil
  20. }
  21. func (nr *fileRegistry) UnRegister(addr *registry.Address) error {
  22. return nil
  23. }
  24. func (nr *fileRegistry) Lookup() ([]string, error) {
  25. addressList := strings.Split(config.GetClientConfig().TransactionServiceGroup, ",")
  26. return addressList, nil
  27. }
  28. func (nr *fileRegistry) Subscribe(notifyListener registry.EventListener) error {
  29. return nil
  30. }
  31. func (nr *fileRegistry) UnSubscribe(notifyListener registry.EventListener) error {
  32. return nil
  33. }
  34. func newFileRegistry() (registry.Registry, error) {
  35. tmpRegistry := &fileRegistry{}
  36. return tmpRegistry, nil
  37. }