code: func (ss *FileSubStore) CreateSub(sub *spb.SubState) error {
  	// Check if we can create the subscription (check limits and update
  	// subscription count)
  	ss.Lock()
  	defer ss.Unlock()
  	if err := ss.createSub(sub); err != nil {
  		return err
  	}
  	if err := ss.writeRecord(nil, subRecNew, sub); err != nil {
  		delete(ss.subs, sub.ID)
  		return err
  	}
  	// We need to get a copy of the passed sub, we can't hold a reference
  	// to it.
  	csub := *sub
  	s := &subscription{sub: &csub, seqnos: make(map[uint64]struct{})}
  	ss.subs[sub.ID] = s
  	return nil
  }
docs: // CreateSub records a new subscription represented by SubState. On success,
  // it returns an id that is used by the other methods.