model.go 768 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package model
  2. import (
  3. "errors"
  4. "sync"
  5. "go-common/library/time"
  6. )
  7. // ErrBusinessNotReady business is not ready.
  8. var ErrBusinessNotReady = errors.New("error buiness is not ready")
  9. // ArgBusiness rpc arg
  10. type ArgBusiness struct {
  11. BusinessID int64
  12. Token string
  13. }
  14. // Key rpc sharding key.
  15. func (a *ArgBusiness) Key() int64 {
  16. return a.BusinessID
  17. }
  18. // Business business seq struct
  19. type Business struct {
  20. ID int64
  21. CurSeq int64
  22. MaxSeq int64
  23. Step int64
  24. Perch int64
  25. BenchTime int64
  26. LastTimestamp int64
  27. Token string
  28. CTime time.Time
  29. MTime time.Time
  30. Mutex sync.Mutex
  31. }
  32. // SeqVersion seq-server version
  33. type SeqVersion struct {
  34. IDC int64
  35. SvrNum int64
  36. SvrTime int64
  37. }