code: func (gss *genericSubStore) createSub(sub *spb.SubState) error {
  	if gss.limits.MaxSubscriptions > 0 && len(gss.subs) >= gss.limits.MaxSubscriptions {
  		return ErrTooManySubs
  	}
  
  	// Bump the max value before assigning it to the new subscription.
  	gss.maxSubID++
  
  	// This new subscription has the max value.
  	sub.ID = gss.maxSubID
  	// Store anything. Some implementations may replace with specific
  	// object.
  	gss.subs[sub.ID] = emptySub
  
  	return nil
  }
docs: // createSub checks that the number of subscriptions is below the max
  // and if so, assigns a new subscription ID and keep track of it in a map.
  // Lock is assumed to be held on entry.