code: func (ss *subStore) Store(sub *subState) error {
  	if sub == nil {
  		return nil
  	}
  
  	// Adds to storage.
  	// Use sub lock to avoid race with waitForAcks in some tests
  	sub.Lock()
  	err := sub.store.CreateSub(&sub.SubState)
  	sub.Unlock()
  	if err == nil {
  		err = sub.store.Flush()
  	}
  	if err != nil {
  		ss.stan.log.Errorf("Unable to store subscription [%v:%v] on [%s]: %v", sub.ClientID, sub.Inbox, sub.subject, err)
  		return err
  	}
  
  	ss.Lock()
  	ss.updateState(sub)
  	ss.Unlock()
  
  	return nil
  }
docs: // Store adds this subscription to the server's `subStore` and also in storage