sync_retry.go 555 B

12345678910111213141516171819202122232425262728293031323334
  1. package common
  2. import "fmt"
  3. const (
  4. _ctypeSN = "retry_sn"
  5. _ctypeEP = "retry_ep"
  6. )
  7. // SyncRetry is the struct used for retry info storage
  8. type SyncRetry struct {
  9. Ctype string
  10. Retry int
  11. CID int64
  12. }
  13. // FromSn def.
  14. func (v *SyncRetry) FromSn(retry int, sid int64) {
  15. v.Ctype = _ctypeSN
  16. v.Retry = retry
  17. v.CID = sid
  18. }
  19. // FromEp def.
  20. func (v *SyncRetry) FromEp(retry int, epid int64) {
  21. v.Ctype = _ctypeEP
  22. v.Retry = retry
  23. v.CID = epid
  24. }
  25. // MCKey def.
  26. func (v *SyncRetry) MCKey() (key string) {
  27. return v.Ctype + "_" + fmt.Sprintf("%d", v.CID)
  28. }