-func (s *Subscription) Confirmed() {
- s.mutex.Lock()
- defer s.mutex.Unlock()
- s.Active = true
-}
-
-func (s *Subscription) UnConfirmed() {
- s.mutex.Lock()
- defer s.mutex.Unlock()
- s.Active = false
-}
-
-func (s *Subscription) IsConfirmed() bool {
- s.mutex.Lock()
- defer s.mutex.Unlock()
- return s.Active
-}
-
-func (s *Subscription) IsEndpoint(ep *RmrEndpoint) bool {
- s.mutex.Lock()
- defer s.mutex.Unlock()
- return s.EpList.HasEndpoint(ep)
-}
-
-func (s *Subscription) SetTransaction(trans *Transaction) error {
- s.mutex.Lock()
- defer s.mutex.Unlock()
-
- if s.Trans != nil {
- return fmt.Errorf("subs(%s) trans(%s) exist, can not register trans(%s)", s.stringImpl(), s.Trans, trans)
- }
- trans.Subs = s
- s.Trans = trans
-
- if len(s.EpList.Endpoints) == 0 {
- s.EpList.Endpoints = append(s.EpList.Endpoints, trans.RmrEndpoint)
- return s.updateRouteImpl(CREATE)
- } else if s.EpList.HasEndpoint(&trans.RmrEndpoint) == false {
- s.EpList.Endpoints = append(s.EpList.Endpoints, trans.RmrEndpoint)
- return s.updateRouteImpl(MERGE)
- }
- return nil
-}
-
-func (s *Subscription) UnSetTransaction(trans *Transaction) bool {