// offset returns the current write offset.
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)
}
784792
func Offset(page uint, limit uint) uint {
	if page == 0 {
		page = 1
	}
	return (page - 1) * limit
}
1253138
func (b *BytesRefBuilder) Set(offset int, v byte) {
	b.ref.Bytes[offset] = v
}
299087
func (s *MultiTermvectorItem) Offsets(offsets bool) *MultiTermvectorItem {
	s.offsets = &offsets
	return s
}
417234
func (s *ScanOp) Offset(token string) *ScanOp {
	s.token = token
	return s
}
644684
func (d *Decoder) Seek(offset int64, whence int) (int64, error) {
	return d.r.Seek(offset, whence)
}
1193250
func (v *Signature) Offset() int {
	_, offset := v.When.Zone()
	return offset / 60
}
550667
func (w *PosixWriter) Flush() error {
	l := len(w.buffer)
	offset := 0
	retry := 0
	for {
		n, err := syscall.Write(w.fd, w.buffer[offset:])
		if err != nil {
			if retry < flushMaxRetryCount {
				retry++
				continue
			}
			return err
		}
		offset += n
		if offset == l {
			break
		}
	}
	w.buffer = []byte{}
	return nil
}
356361
func (stmt SelectStmt) Offset(offset int) SelectStmt {
	stmt.offset = offset
	return stmt
}
274081
func (e *Etcd) Allocate(offset int) (bool, error) {
	e.lock.Lock()
	defer e.lock.Unlock()

	ok, err := e.alloc.Allocate(offset)
	if !ok || err != nil {
		return ok, err
	}

	err = e.tryUpdate(func() error {
		ok, err := e.alloc.Allocate(offset)
		if err != nil {
			return err
		}
		if !ok {
			return errorUnableToAllocate
		}
		return nil
	})
	if err != nil {
		if err == errorUnableToAllocate {
			return false, nil
		}
		return false, err
	}
	return true, nil
}
833167
func (q *TransactionQuery) Offset(amount uint) *TransactionQuery {
	q.query.Offset(amount)
	return q
}
191751
func (o *LargeObject) Seek(offset int64, whence int) (n int64, err error) {
	if o.lo.Has64 {
		n, err = fpInt64(o.lo.fp.CallFn("lo_lseek64", []fpArg{fpIntArg(o.fd), fpInt64Arg(offset), fpIntArg(int32(whence))}))
	} else {
		var n32 int32
		n32, err = fpInt32(o.lo.fp.CallFn("lo_lseek", []fpArg{fpIntArg(o.fd), fpIntArg(int32(offset)), fpIntArg(int32(whence))}))
		n = int64(n32)
	}
	return
}
625703
func (r *readerOffsets) AddKey(offset uint32, key []byte) {
	r.offsets = append(r.offsets, offset)
	pre := keyPrefix(key)
	if r.entry.pre != pre && r.entry.total != 0 {
		r.prefixes = append(r.prefixes, r.entry)
	}
	r.entry.pre = pre
	r.entry.total++
}
279765
func (bg *Reader) Seek(off Offset) error {
	rs, ok := bg.r.(io.ReadSeeker)
	if !ok {
		return ErrNotASeeker
	}

	if off.File != bg.current.Base() || !bg.current.hasData() {
		ok := bg.cacheSwap(off.File)
		if !ok {
			var dec *decompressor
			if bg.dec != nil {
				dec = bg.dec
			} else {
				select {
				case dec = <-bg.waiting:
				case dec = <-bg.working:
					blk, err := dec.wait()
					if err == nil {
						bg.keep(blk)
					}
				}
			}
			bg.current, bg.err = dec.
				using(bg.current).
				nextBlockAt(off.File, rs).
				wait()
			if bg.dec == nil {
				select {
				case <-bg.control:
				default:
				}
				bg.control <- bg.current.NextBase()
				bg.waiting <- dec
			}
			bg.Header = bg.current.header()
			if bg.err != nil {
				return bg.err
			}
		}
	}

	bg.err = bg.current.seek(int64(off.Block))
	if bg.err == nil {
		bg.lastChunk = Chunk{Begin: off, End: off}
	}

	return bg.err
}
91395
func (bldr *TodoQueryBuilder) Offset(offset int) *TodoQueryBuilder {
	bldr.q = bldr.q.Offset(offset)
	if bldr.plugin != nil {
		bldr.plugin.Offset(offset)
	}
	return bldr
}
132272
func (s *QuotaSettings) SetOffset(v int64) *QuotaSettings {
	s.Offset = &v
	return s
}
756160
func (q *Query) Offset(amount uint) *Query {
	q.query.Offset(amount)
	return q
}