// Offset setup to query.
498827
func (bldr *aeDatastoreAdminOperationQueryBuilder) Offset(offset int) *aeDatastoreAdminOperationQueryBuilder {
	bldr.q = bldr.q.Offset(offset)
	if bldr.plugin != nil {
		bldr.plugin.Offset(offset)
	}
	return bldr
}
319567
func (bldr *aeBackupInformationKindTypeInfoQueryBuilder) Offset(offset int) *aeBackupInformationKindTypeInfoQueryBuilder {
	bldr.q = bldr.q.Offset(offset)
	if bldr.plugin != nil {
		bldr.plugin.Offset(offset)
	}
	return bldr
}
437961
func (b *bufWriter) offset() uint32 {
	off, _ := b.file.Seek(0, 1)
	off += int64(len(b.buf))
	if int64(uint32(off)) != off {
		log.Fatalf("index is larger than 4GB")
	}
	return uint32(off)
}
368353
func (c *connection) Offset(req *proto.OffsetReq) (*proto.OffsetResp, error) {
	// TODO(husio) documentation is not mentioning this directly, but I assume
	// -1 is for non node clients
	req.ReplicaID = -1

	b, err := c.sendRequest(req)
	if err != nil {
		return nil, err
	}
	return proto.ReadVersionedOffsetResp(bytes.NewReader(b), req.GetVersion())
}
1000173
func (bldr *UserQueryBuilder) Offset(offset int) *UserQueryBuilder {
	bldr.q = bldr.q.Offset(offset)
	if bldr.plugin != nil {
		bldr.plugin.Offset(offset)
	}
	return bldr
}
859949
func Skip(offset int) func(*index.Options) {
	return func(opts *index.Options) {
		opts.Skip = offset
	}
}
1245945
func (s *UpdateByQueryService) Query(query Query) *UpdateByQueryService {
	s.query = query
	return s
}
1248998
func (s *Matrix) offset(dims []int) int {
	if len(dims) != len(s.dims) {
		panic("incorrect dimensions")
	}

	i := 0
	for n, v := range dims {
		if v > s.dims[n] {
			panic("incorrect dimensions")
		}

		i += v * s.offsets[n]
	}

	return i
}
167359
func (s *Segment) FindOffsetPosition(offset uint64) (int64, error) {
	if _, err := s.log.Seek(0, 0); err != nil {
		return 0, err
	}

	var position int64
	for {
		b := new(bytes.Buffer)
		// get offset and size
		_, err := io.CopyN(b, s.log, 8)
		if err != nil {
			return position, ErrOffsetNotFound
		}
		o := encoding.Uint64(b.Bytes()[offsetPos:8])

		_, err = io.CopyN(b, s.log, 4)
		if err != nil {
			return position, ErrOffsetNotFound
		}
		size := int64(encoding.Uint32(b.Bytes()[sizePos:12]))

		if offset == o {
			log.With("position", position).With("offset", o).Infoln("found offset position")
			return position, nil
		}
		position += size + logEntryHeaderLen

		// add 9 to size to include the timestamp and attribute
		_, err = s.log.Seek(size+9, 1)
		if err != nil {
			return 0, err
		}
	}
}
563171
func (batch *Batch) Offset() int64 {
	batch.mutex.Lock()
	offset := batch.offset
	batch.mutex.Unlock()
	return offset
}
106377
func (l Log) PutOffset(offset int64) {
	encoding.PutUint64(l[offsetPos:sizePos], uint64(offset))
}
322164
func (t *Table) GetOffset() (row, column int) {
	return t.rowOffset, t.columnOffset
}
367280
func (t T) Offset(origin kml.Coordinate, distance, bearing float64) kml.Coordinate {
	lat := math.Asin(math.Sin(origin.Lat*radians)*math.Cos(distance/t.R) + math.Cos(origin.Lat*radians)*math.Sin(distance/t.R)*math.Cos(bearing*radians))
	lon := origin.Lon*radians + math.Atan2(math.Sin(bearing*radians)*math.Sin(distance/t.R)*math.Cos(origin.Lat*radians), math.Cos(distance/t.R)-math.Sin(origin.Lat*radians)*math.Sin(lat))
	return kml.Coordinate{
		Lon: lon * degrees,
		Lat: lat * degrees,
		Alt: origin.Alt,
	}
}
963560
func (s *storageImpl) getNextOffset(ctx context.Context, url string, length int64) (offset int64, err error) {
	r, err := http.NewRequest("PUT", url, nil)
	if err != nil {
		return
	}
	r.Header.Set("Content-Range", fmt.Sprintf("bytes */%d", length))
	r.Header.Set("Content-Length", "0")
	r.Header.Set("User-Agent", s.userAgent)
	resp, err := ctxhttp.Do(ctx, s.client, r)
	if err != nil {
		if isTemporaryNetError(err) {
			err = errTransientError
		}
		return
	}
	resp.Body.Close()

	if resp.StatusCode == 200 {
		// Fully uploaded.
		offset = length
	} else if resp.StatusCode == 308 {
		// Partially uploaded, extract last uploaded offset from Range header.
		rangeHeader := resp.Header.Get("Range")
		if rangeHeader != "" {
			_, err = fmt.Sscanf(rangeHeader, "bytes=0-%d", &offset)
			if err == nil {
				// |offset| is an *offset* of a last uploaded byte, not the data length.
				offset++
			}
		}
	} else if isTemporaryHTTPError(resp.StatusCode) {
		err = errTransientError
	} else {
		err = fmt.Errorf("unexpected response (HTTP %d) when querying for uploaded offset", resp.StatusCode)
	}
	return
}
1137984
func (s *ScrollService) Query(query Query) *ScrollService {
	s.ss = s.ss.Query(query)
	return s
}
968156
func (f *File) DataOffset() (offset int64, err error) {
	bodyOffset, err := f.findBodyOffset()
	if err != nil {
		return
	}
	return f.headerOffset + bodyOffset, nil
}
833167
func (q *TransactionQuery) Offset(amount uint) *TransactionQuery {
	q.query.Offset(amount)
	return q
}