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

34 lines
599 B

  1. package taskrpc
  2. import (
  3. "git.tetele.net/tgo/conf"
  4. )
  5. type Req struct {
  6. SiteId string
  7. Dbname string
  8. }
  9. type Res struct {
  10. Errcode int
  11. Errmsg string
  12. }
  13. func rpc_server_conn(url ...string) (*TaskServiceClient, error) {
  14. var rpc_url string
  15. if len(url) > 0 && url[0] != "" {
  16. rpc_url = url[0]
  17. } else if conf.TASK_RPC_URL != "" {
  18. rpc_url = conf.TASK_RPC_URL
  19. } else {
  20. rpc_url = "127.0.0.1:" + conf.TASK_RPC_PORT
  21. }
  22. conn, _, err := DialTaskService("tcp", rpc_url)
  23. if err != nil {
  24. return nil, err
  25. }
  26. return conn, nil
  27. }