// Returns partNumber.etag
979867
func (fs *FSObjects) encodePartFile(partNumber int, etag string, actualSize int64) string {
	return fmt.Sprintf("%.5d.%s.%d", partNumber, etag, actualSize)
}
815870
func Slug(s string, sep string) string {
	if s == "" {
		return ""
	}
	slug := slugRegex.ReplaceAllString(s, sep)
	if slug == "" {
		return ""
	}
	quoted := regexp.QuoteMeta(sep)
	sepRegex := regexp.MustCompile("(" + quoted + "){2,}")
	slug = sepRegex.ReplaceAllString(slug, sep)
	sepEnds := regexp.MustCompile("^" + quoted + "|" + quoted + "$")
	slug = sepEnds.ReplaceAllString(slug, "")
	return strings.ToLower(slug)
}
327928
func (m *MemMulti) NumPutParts() int {
	m.Lock()
	defer m.Unlock()

	return m.numPutParts
}
1068389
func (s *CreatePublicKeyOutput) SetETag(v string) *CreatePublicKeyOutput {
	s.ETag = &v
	return s
}
984801
func NewETagConfig() *ETagConfig {
	return &ETagConfig{
		MinBodyLength: 1024,
		EnableMethod: map[string]bool{
			"GET": true,
		},
		EnableStatus: map[int]bool{
			0:             true,
			http.StatusOK: true,
		},
		IgnoreIfHeaderExist: map[string]bool{
			"If-Modified-Since": true,
		},
		IgnoreIfHeaderValue: map[string]string{
			"Upgrade": "websocket",
		},
		HashFunc: func(data []byte) string {
			hash := md5.Sum(data)
			return fmt.Sprintf("%x", hash)
		},
	}
}
790841
func (mo *MergeOperatorStringAppend) PartialMerge(key,
	leftOperand, rightOperand []byte) ([]byte, bool) {
	mo.m.Lock()
	mo.numPartial++
	mo.m.Unlock()

	return []byte(string(leftOperand) + mo.Sep + string(rightOperand)), true
}
1000938
func getScheme(rawurl string) (scheme, path string) {
	urlSplits := strings.Split(rawurl, "://")
	if len(urlSplits) == 2 {
		scheme, uri := urlSplits[0], "//"+urlSplits[1]
		// ignore numbers in scheme
		validScheme := regexp.MustCompile("^[a-zA-Z]+$")
		if uri != "" {
			if validScheme.MatchString(scheme) {
				return scheme, uri
			}
		}
	}
	return "", rawurl
}
1311490
func (t *Team) GetSlug() string {
	if t == nil || t.Slug == nil {
		return ""
	}
	return *t.Slug
}
1110522
func (s *CompletedPart) SetETag(v string) *CompletedPart {
	s.ETag = &v
	return s
}
1008
func (c *spanContext) parseBaggageInt64(key string) int64 {
	var val int64
	c.ForeachBaggageItem(func(k, v string) bool {
		if strings.ToLower(k) == strings.ToLower(key) {
			i, err := strconv.ParseInt(v, 10, 64)
			if err != nil {
				// TODO handle err
				return true
			}
			val = i
			return false
		}
		return true
	})
	return val
}
644662
func parseNumberString(nstr string) ([]int, error) {
	nstrs := strings.Split(nstr, ".")
	if len(nstrs) < 1 || len(nstrs) > 3 {
		return nil, errors.New(ErrIllegalVersionFormat, errorMessages, "wrong number parts")
	}
	vsn := []int{1, 0, 0}
	for i, nstr := range nstrs {
		num, err := strconv.Atoi(nstr)
		if err != nil {
			return nil, errors.New(ErrIllegalVersionFormat, errorMessages, err.Error())
		}
		if num < 0 {
			return nil, errors.New(ErrIllegalVersionFormat, errorMessages, "negative version number")
		}
		vsn[i] = num
	}
	return vsn, nil
}
3013
func (m *Match) GroupByNumber(num int) *Group {
	// check our sparse map
	if m.sparseCaps != nil {
		if newNum, ok := m.sparseCaps[num]; ok {
			num = newNum
		}
	}
	if num >= len(m.matchcount) || num < 0 {
		return nil
	}

	if num == 0 {
		return &m.Group
	}

	m.populateOtherGroups()

	return &m.otherGroups[num-1]
}
1203023
func (s Slice) GetSmallInt() (int64, error) {
	h := s.head()

	if h >= 0x30 && h <= 0x39 {
		// Smallint >= 0
		return int64(h - 0x30), nil
	}

	if h >= 0x3a && h <= 0x3f {
		// Smallint < 0
		return int64(h-0x3a) - 6, nil
	}

	if (h >= 0x20 && h <= 0x27) || (h >= 0x28 && h <= 0x2f) {
		// Int and UInt
		// we'll leave it to the compiler to detect the two ranges above are
		// adjacent
		return s.GetInt()
	}

	return 0, InvalidTypeError{"Expecting type SmallInt"}
}
147188
func (s *CopyPartResult) SetETag(v string) *CopyPartResult {
	s.ETag = &v
	return s
}
520102
func parseGWParts(gwMetaBuf []byte) []minio.ObjectPartInfo {
	// Parse the GW Parts.
	partsResult := gjson.GetBytes(gwMetaBuf, "parts").Array()
	partInfo := make([]minio.ObjectPartInfo, len(partsResult))
	for i, p := range partsResult {
		info := minio.ObjectPartInfo{}
		info.Number = int(p.Get("number").Int())
		info.Name = p.Get("name").String()
		info.ETag = p.Get("etag").String()
		info.Size = p.Get("size").Int()
		partInfo[i] = info
	}
	return partInfo
}
802717
func (s *Item) SetETag(v string) *Item {
	s.ETag = &v
	return s
}
127811
func GenerateSlug(str string) (slug string) {
	return strings.Map(func(r rune) rune {
		switch {
		case r == ' ', r == '-':
			return '-'
		case r == '_', unicode.IsLetter(r), unicode.IsDigit(r):
			return r
		default:
			return -1
		}
		return -1
	}, strings.ToLower(strings.TrimSpace(str)))
}