// getting value for second fragments from second value
423277
func secondFragments(second string) (sec, milliSec, microSec, nanoSec, picoSec int) {
	fragments := strings.Split(second, ".")

	if len(fragments) > 0 {
		sec, _ = strconv.Atoi(fragments[0])
	}
	if len(fragments) > 1 {
		milliSec, _ = strconv.Atoi(fragments[1])
	}
	if len(fragments) > 2 {
		microSec, _ = strconv.Atoi(fragments[2])
	}
	if len(fragments) > 3 {
		nanoSec, _ = strconv.Atoi(fragments[3])
	}
	if len(fragments) > 4 {
		picoSec, _ = strconv.Atoi(fragments[4])
	}
	return
}
507176
func IndirectValue(v reflect.Value) reflect.Value {
	if k := v.Kind(); k == reflect.Ptr { //|| k == reflect.Interface {
		return v.Elem()
	}
	return v
}
1168543
func (v *KeyValue_SetValue_Args) GetValue() (o string) {
	if v != nil && v.Value != nil {
		return *v.Value
	}

	return
}
192643
func (list *List) GetValue() interface{} {
	var values []interface{}
	for _, val := range list.values {
		values = append(values, val.GetValue())
	}
	return values
}
1283440
func (cm *ProtoConsumerMessage) GetPrevValue(msg proto.Message) (prevValueExist bool, err error) {
	prevVal := cm.ConsumerMessage.GetPrevValue()
	if prevVal == nil {
		return false, nil
	}
	err = cm.serializer.Unmarshal(prevVal, msg)
	if err != nil {
		return true, err
	}
	return true, nil
}
466573
func (c *Client) GetValues(keys []string) (map[string]string, error) {
	// Use all operations on the same revision
	var first_rev int64 = 0
	vars := make(map[string]string)
	// Default ETCDv3 TXN limitation. Since it is configurable from v3.3,
	// maybe an option should be added (also set max-txn=0 can disable Txn?)
	maxTxnOps := 128
	getOps := make([]string, 0, maxTxnOps)
	doTxn := func (ops []string) error {
		ctx, cancel := context.WithTimeout(context.Background(), time.Duration(3) * time.Second)
		defer cancel()
		
		txnOps := make([]clientv3.Op, 0, maxTxnOps)
		
		for _, k := range ops {
			txnOps = append(txnOps, clientv3.OpGet(k,
											   clientv3.WithPrefix(),
											   clientv3.WithSort(clientv3.SortByKey, clientv3.SortDescend),
											   clientv3.WithRev(first_rev)))
		}
		
		result, err := c.client.Txn(ctx).Then(txnOps...).Commit()
		if err != nil {
			return err
		}
		for i, r := range result.Responses {
			originKey := ops[i]
			// append a '/' if not already exists
			originKeyFixed := originKey
			if !strings.HasSuffix(originKeyFixed, "/") {
				originKeyFixed = originKey + "/"
			}
			for _, ev := range r.GetResponseRange().Kvs {
				k := string(ev.Key)
				if k == originKey || strings.HasPrefix(k, originKeyFixed) {
					vars[string(ev.Key)] = string(ev.Value)
				}
			}
		}
		if first_rev == 0 {
			// Save the revison of the first request
			first_rev = result.Header.GetRevision()
		}
		return nil
	}
	for _, key := range keys {
		getOps = append(getOps, key)
		if len(getOps) >= maxTxnOps {
			if err := doTxn(getOps); err != nil {
				return vars, err
			}
			getOps = getOps[:0]
		}
	}
	if len(getOps) > 0 {
		if err := doTxn(getOps); err != nil {
			return vars, err
		}
	}
	return vars, nil
}
105730
func (p *PushEvent) GetAfter() string {
	if p == nil || p.After == nil {
		return ""
	}
	return *p.After
}
940250
func (mvl *MetricsList) GetTagValue(tag string) (value string, e error) {
	if value, ok := mvl.tags[tag]; !ok {
		return value, errors.New("Tag unknown!")
	} else {
		return value, e
	}
}
1146861
func (v *view) allFragments() []*fragment {
	v.mu.Lock()
	defer v.mu.Unlock()

	other := make([]*fragment, 0, len(v.fragments))
	for _, fragment := range v.fragments {
		other = append(other, fragment)
	}
	return other
}
1344087
func (rule *overlappingFieldsCanBeMergedRule) collectConflictsBetweenFragments(conflicts []conflict, areMutuallyExclusive bool, fragmentName1 string, fragmentName2 string) []conflict {
	fragment1 := rule.context.Fragment(fragmentName1)
	fragment2 := rule.context.Fragment(fragmentName2)

	if fragment1 == nil || fragment2 == nil {
		return conflicts
	}

	// No need to compare a fragment to itself.
	if fragment1 == fragment2 {
		return conflicts
	}

	// Memoize so two fragments are not compared for conflicts more than once.
	if rule.comparedSet.Has(fragmentName1, fragmentName2, areMutuallyExclusive) {
		return conflicts
	}
	rule.comparedSet.Add(fragmentName1, fragmentName2, areMutuallyExclusive)

	fieldsInfo1 := rule.getReferencedFieldsAndFragmentNames(fragment1)
	fieldsInfo2 := rule.getReferencedFieldsAndFragmentNames(fragment2)

	// (F) First, collect all conflicts between these two collections of fields
	// (not including any nested fragments).
	conflicts = rule.collectConflictsBetween(conflicts, areMutuallyExclusive, fieldsInfo1, fieldsInfo2)

	// (G) Then collect conflicts between the first fragment and any nested
	// fragments spread in the second fragment.
	for _, innerFragmentName2 := range fieldsInfo2.fragmentNames {
		conflicts = rule.collectConflictsBetweenFragments(conflicts, areMutuallyExclusive, fragmentName1, innerFragmentName2)
	}

	// (G) Then collect conflicts between the second fragment and any nested
	// fragments spread in the first fragment.
	for _, innerFragmentName1 := range fieldsInfo1.fragmentNames {
		conflicts = rule.collectConflictsBetweenFragments(conflicts, areMutuallyExclusive, innerFragmentName1, fragmentName2)
	}

	return conflicts
}
1014014
func (mc MongoClient) getValueDescriptors(q bson.M) ([]models.ValueDescriptor, error) {
	s := mc.getSessionCopy()
	defer s.Close()

	var v []models.ValueDescriptor
	if err := s.DB(mc.database.Name).C(db.ValueDescriptorCollection).Find(q).All(&v); err != nil {
		return []models.ValueDescriptor{}, errorMap(err)
	}
	return v, nil
}
1188928
func (it *ValIterator) GetNext(outVal interface{}) (stop bool) {
	if m, ok := outVal.(map[string]interface{}); ok {
		ok = it.Delegate.ScanMap(m)
		return !ok //if not ok than stop
	}

	_, ptrs := structs.ListExportedFieldsPtrs(outVal, cqlExported)
	ok := it.Delegate.Scan(ptrs...)
	return !ok //if not ok than stop
}
366910
func (itr *tagValueMergeIterator) Next() (_ []byte, err error) {
	// Find next lowest value amongst the buffers.
	var value []byte
	for i, buf := range itr.buf {
		// Fill buffer.
		if buf == nil {
			if buf, err = itr.itrs[i].Next(); err != nil {
				return nil, err
			} else if buf != nil {
				itr.buf[i] = buf
			} else {
				continue
			}
		}

		// Find next lowest value.
		if value == nil || bytes.Compare(buf, value) == -1 {
			value = buf
		}
	}

	// Return nil if no elements remaining.
	if value == nil {
		return nil, nil
	}

	// Merge elements and clear buffers.
	for i, buf := range itr.buf {
		if buf == nil || !bytes.Equal(buf, value) {
			continue
		}
		itr.buf[i] = nil
	}
	return value, nil
}
1094196
func (v *view) Fragment(shard uint64) *fragment {
	v.mu.RLock()
	defer v.mu.RUnlock()
	return v.fragments[shard]
}
159841
func (l *Client) GetSegments(table string) ([]*Segment, error) {
	res := ApiResp{}
	data := []*Segment{}
	params := url.Values{}

	params.Add("table", table)

	// make the request
	err := l.Get(segmentListEndpoint, params, nil, &res, &data)
	if err != nil {
		return data, err
	}

	return data, nil
}
500814
func (d Duration) Second() int {
	_, _, _, second, _ := splitDuration(d.Duration)
	return second
}
1079540
func compareListValuesAtIndex(list1Inbounds, list2Inbounds bool, list1Value, list2Value string) (interface{}, interface{}) {
	bothInBounds := list1Inbounds && list2Inbounds
	switch {
	// scalars are identical
	case bothInBounds && list1Value == list2Value:
		return nil, nil
	// only list2 is in bound
	case !list1Inbounds:
		fallthrough
	// list2 has additional scalar
	case bothInBounds && list1Value > list2Value:
		return nil, list2Value
	// only original is in bound
	case !list2Inbounds:
		fallthrough
	// original has additional scalar
	case bothInBounds && list1Value < list2Value:
		return list1Value, nil
	default:
		return nil, nil
	}
}