options.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package options
  15. import (
  16. common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
  17. )
  18. type NotifyOption struct {
  19. common_options.CommonOptions
  20. common_options.DBOptions
  21. DebugRequest bool `help:"Debug Send request"`
  22. SocketFileDir string `help:"Socket file directory" default:"/etc/yunion/socket"`
  23. UpdateInterval int `help:"Update send services interval(unit:min)" default:"30"`
  24. ReSendScope int `help:"Resend all messages that have not been sent successfully within ReSendScope seconds" default:"60"`
  25. MaxSendTimes int `help:"Resend all messages whose sendTimes less than MaxSendTimes" default:"2"`
  26. InitNotificationScope int `help:"initialize data of notification with in InitNotificationScope hours" default:"100"`
  27. MaxSyncNotification int `help:"The max number of notification sync from old data source" default:"1000"`
  28. VerifyExpireInterval int `help:"expire interval of verify message; minutes" default:"2"`
  29. VerifyValidInterval int `help:"valid interval of verify message; miniutes" default:"20"`
  30. SyncReceiverIntervalMinutes int `help:"interval to sync receivers from keystone, in minutes" default:"30"`
  31. EnableWatchUser bool `help:"use etcd to watch user" default:"false"`
  32. }
  33. var Options NotifyOption
  34. func OnOptionsChange(oldO, newO interface{}) bool {
  35. oldOpts := oldO.(*NotifyOption)
  36. newOpts := newO.(*NotifyOption)
  37. changed := false
  38. if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
  39. changed = true
  40. }
  41. if oldOpts.SocketFileDir != newOpts.SocketFileDir {
  42. changed = true
  43. }
  44. return changed
  45. }