// GetPartial fetches part of the blob in container.
// If length is negative, the rest of the object is returned.
// The caller must close rc.
7168
func (c *Client) GetPartial(ctx context.Context, container, key string, offset, length int64) (rc io.ReadCloser, err error) {
	if offset < 0 {
		return nil, errors.New("invalid negative length")
	}

	req := newReq(ctx, c.keyURL(container, key))
	if length >= 0 {
		req.Header.Set("Range", fmt.Sprintf("bytes=%d-%d", offset, offset+length-1))
	} else {
		req.Header.Set("Range", fmt.Sprintf("bytes=%d-", offset))
	}
	c.Auth.SignRequest(req)

	res, err := c.transport().RoundTrip(req)
	if err != nil {
		return
	}
	switch res.StatusCode {
	case http.StatusOK, http.StatusPartialContent:
		return res.Body, nil
	case http.StatusNotFound:
		res.Body.Close()
		return nil, os.ErrNotExist
	default:
		res.Body.Close()
		return nil, fmt.Errorf("azure HTTP error on GET: %d", res.StatusCode)
	}
}
1210198
func (c *Client) FetchStruct(bucket, key string, out interface{}) (*RpbGetResp, error) {
	return c.fetchStruct(nil, bucket, key, out)
}
775535
func getPartFile(entries []string, partNumber int, etag string) string {
	for _, entry := range entries {
		if strings.HasPrefix(entry, fmt.Sprintf("%.5d.%s.", partNumber, etag)) {
			return entry
		}
	}
	return ""
}
1144518
func (r *Rego) PrepareForPartial(ctx context.Context, opts ...PrepareOption) (PreparedPartialQuery, error) {
	if !r.hasQuery() {
		return PreparedPartialQuery{}, fmt.Errorf("cannot evaluate empty query")
	}

	pCfg := &PrepareConfig{}
	for _, o := range opts {
		o(pCfg)
	}

	txn := r.txn

	var err error
	if txn == nil {
		txn, err = r.store.NewTransaction(ctx)
		if err != nil {
			return PreparedPartialQuery{}, err
		}
		defer r.store.Abort(ctx, txn)
	}

	err = r.prepare(ctx, txn, partialQueryType, []extraStage{
		{
			after: "CheckSafety",
			stage: r.rewriteEqualsForPartialQueryCompile,
		},
	})

	if err != nil {
		return PreparedPartialQuery{}, err
	}

	return PreparedPartialQuery{preparedQuery{r, pCfg}}, err
}
1309233
func (t *PrimaryTree) Get(k uint64) (v SecondaryLayer, ok bool) {
	q := t.r
	if q == nil {
		return
	}

	for {
		var i int
		if i, ok = t.find(q, k); ok {
			switch x := q.(type) {
			case *x1:
				q = x.x[i+1].ch
				continue
			case *d1:
				return x.d[i].v, true
			}
		}
		switch x := q.(type) {
		case *x1:
			q = x.x[i].ch
		default:
			return
		}
	}
}
435626
func (t *partitionedTable) GetPartition(pid int64) table.PhysicalTable {
	return t.partitions[pid]
}
1110155
func (s *RedisQueueStore) GetFront(key string, length int) (res []string, err error) {
	if !strings.HasPrefix(key, s.prefix) {
		key = s.prefix + key
	}
	res, err = s.client.LRange(key, 0, int64(length-1)).Result()
	if err == redis.Nil {
		return res, nil
	}
	return res, err
}
575671
func (mmf *maxMinFunction) GetPartialResult(evalCtx *AggEvaluateContext) []types.Datum {
	return []types.Datum{mmf.GetResult(evalCtx)}
}
1303499
func RemovePartial(name string) {
	partialsMutex.Lock()
	defer partialsMutex.Unlock()

	delete(partials, name)
}
884977
func (b *Blob) ByteParts() []BytesPart {
	// TODO: move this method off Blob, and make the caller go
	// through a (*Blob).ByteBackedBlob() comma-ok accessor first.
	s := make([]BytesPart, len(b.ss.Parts))
	for i, part := range b.ss.Parts {
		s[i] = *part
	}
	return s
}
1069033
func parsePartialTime(buff []byte, cursor *int, l int) (partialTime, error) {
	var pt partialTime

	hour, minute, err := getHourMinute(buff, cursor, l)
	if err != nil {
		return pt, err
	}

	if buff[*cursor] != ':' {
		return pt, ErrInvalidTimeFormat
	}

	*cursor++

	// ----

	seconds, err := parseSecond(buff, cursor, l)
	if err != nil {
		return pt, err
	}

	pt = partialTime{
		hour:    hour,
		minute:  minute,
		seconds: seconds,
	}

	// ----

	if buff[*cursor] != '.' {
		return pt, nil
	}

	*cursor++

	secFrac, err := parseSecFrac(buff, cursor, l)
	if err != nil {
		return pt, nil
	}
	pt.secFrac = secFrac

	return pt, nil
}
521065
func (c *client) handlePartialWrite(pnb net.Buffers) {
	nb := c.collapsePtoNB()
	// The partial needs to be first, so append nb to pnb
	c.out.nb = append(pnb, nb...)
}
1218341
func (m *SingleNodeManager) GetPartitions() []int32 {
	m.RLock()
	defer m.RUnlock()
	return m.node.Partitions
}
826888
func GetContainer(uuid string) (Container, error) {

	url := ""
	if string(uuid[0]) == "/" {
		url = uuid[8:]
	} else {
		url = "container/" + uuid + "/"
	}

	request := "GET"
	//Empty Body Request
	body := []byte(`{}`)
	var response Container

	data, err := TutumCall(url, request, body)
	if err != nil {
		return response, err
	}

	err = json.Unmarshal(data, &response)
	if err != nil {
		return response, err
	}

	return response, nil
}
1264054
func (document *Document) GetPartName(part int) string {
	cPart := C.int(part)
	cPartName := C.get_document_part_name(document.handle, cPart)
	defer C.free(unsafe.Pointer(cPartName))
	return C.GoString(cPartName)
}
1029796
func (d *domainClient) GetPartialAXTree(ctx context.Context, args *GetPartialAXTreeArgs) (reply *GetPartialAXTreeReply, err error) {
	reply = new(GetPartialAXTreeReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "Accessibility.getPartialAXTree", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "Accessibility.getPartialAXTree", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "Accessibility", Op: "GetPartialAXTree", Err: err}
	}
	return
}
913928
func getLastSegment(ID string) (string, error) {
	parts := strings.Split(ID, "/")
	name := parts[len(parts)-1]
	if len(name) == 0 {
		return "", fmt.Errorf("resource name was missing from identifier")
	}

	return name, nil
}