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.

client_impl.go 814 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package client
  2. import (
  3. "gorm.io/driver/mysql"
  4. "gorm.io/gorm"
  5. "gorm.io/gorm/logger"
  6. "gorm.io/gorm/schema"
  7. "time"
  8. )
  9. type client struct {
  10. url string
  11. dataSource string
  12. DbEngin *gorm.DB
  13. }
  14. func (c *client) Task(options TaskOptions) (Task, error) {
  15. task, _ := newTask(c, &options)
  16. return task, nil
  17. }
  18. func newClient(options Options) (Client, error) {
  19. //init dbEngine
  20. dbEngin, _ := gorm.Open(mysql.Open(options.DataSource), &gorm.Config{
  21. NamingStrategy: schema.NamingStrategy{
  22. SingularTable: true,
  23. },
  24. Logger: logger.Default.LogMode(logger.Warn),
  25. })
  26. sqlDB, _ := dbEngin.DB()
  27. sqlDB.SetMaxIdleConns(10)
  28. sqlDB.SetMaxOpenConns(50)
  29. sqlDB.SetConnMaxLifetime(time.Hour)
  30. c := &client{
  31. url: options.Url,
  32. dataSource: options.DataSource,
  33. DbEngin: dbEngin,
  34. }
  35. return c, nil
  36. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.