func ParseRetentionDefs(retentionDefs string) (whisper.Retentions, error) {
	retentions := make(whisper.Retentions, 0)
	for _, retentionDef := range strings.Split(retentionDefs, ",") {
		retentionDef = strings.TrimSpace(retentionDef)
		parts := strings.Split(retentionDef, ":")
		if len(parts) != 2 {
			return nil, fmt.Errorf("bad retentions spec %q", retentionDef)
		}

		// try old format
		val1, err1 := strconv.ParseInt(parts[0], 10, 0)
		val2, err2 := strconv.ParseInt(parts[1], 10, 0)

		if err1 == nil && err2 == nil {
			retention := whisper.NewRetention(int(val1), int(val2))
			retentions = append(retentions, &retention)
			continue
		}

		// try new format
		retention, err := whisper.ParseRetentionDef(retentionDef)
		if err != nil {
			return nil, err
		}
		retentions = append(retentions, retention)
	}
	return retentions, nil
}
func ParseRetentionDefs(retentionDefs string) (whisper.Retentions, error) {
	retentions := make(whisper.Retentions, 0)
	for _, retentionDef := range strings.Split(retentionDefs, ",") {
		retentionDef = strings.TrimSpace(retentionDef)
		parts := strings.Split(retentionDef, ":")
		if len(parts) != 2 {
			return nil, fmt.Errorf("bad retentions spec %q", retentionDef)
		}

		
		val1, err1 := strconv.ParseInt(parts[0], 10, 0)
		val2, err2 := strconv.ParseInt(parts[1], 10, 0)

		if err1 == nil && err2 == nil {
			retention := whisper.NewRetention(int(val1), int(val2))
			retentions = append(retentions, &retention)
			continue
		}

		
		retention, err := whisper.ParseRetentionDef(retentionDef)
		if err != nil {
			return nil, err
		}
		retentions = append(retentions, retention)
	}
	return retentions, nil
}
func ParseRetentionDefs ( retentionDefs string ) ( whisper . Retentions , error ) { retentions := make ( whisper . Retentions , 0 ) for _ , retentionDef := range strings . Split ( retentionDefs , " " ) { retentionDef = strings . TrimSpace ( retentionDef ) parts := strings . Split ( retentionDef , " " ) if len ( parts ) != 2 { return nil , fmt . Errorf ( " " , retentionDef ) } // try old format val1 , err1 := strconv . ParseInt ( parts [ 0 ] , 10 , 0 ) val2 , err2 := strconv . ParseInt ( parts [ 1 ] , 10 , 0 ) if err1 == nil && err2 == nil { retention := whisper . NewRetention ( int ( val1 ) , int ( val2 ) ) retentions = append ( retentions , & retention ) continue } // try new format retention , err := whisper . ParseRetentionDef ( retentionDef ) if err != nil { return nil , err } retentions = append ( retentions , retention ) } return retentions , nil }
// ParseRetentionDefs parses retention definitions into a Retentions structure
ParseRetentionDefs parses retention definitions into a Retentions structure