// resetBuf points buf at storage, sets the length to 0 and sets cap to be a
// multiple of the rate.
559264
func (s *asmState) resetBuf() {
	max := (cap(s.storage) / s.rate) * s.rate
	s.buf = s.storage[:0:max]
}
1026710
func (b *Buffer) Reset() {
	version := b.preOp()
	b.buf.Reset()
	b.postOp(version)
}
462392
func (pool *IntBlockPool) Reset(zeroFillBuffers, reuseFirst bool) {
	if pool.bufferUpto != -1 {
		// We allocated at least one buffer
		if zeroFillBuffers {
			panic("not implemented yet")
		}

		if pool.bufferUpto > 0 || !reuseFirst {
			offset := 0
			if reuseFirst {
				offset = 1
			}
			// Recycle all but the first buffer
			pool.allocator.Recycle(pool.Buffers[offset : 1+pool.bufferUpto])
			for i := offset; i <= pool.bufferUpto; i++ {
				pool.Buffers[i] = nil
			}
		}
		if reuseFirst {
			panic("not implemented yet")
		} else {
			pool.bufferUpto = -1
			pool.IntUpto = INT_BLOCK_SIZE
			pool.IntOffset = -INT_BLOCK_SIZE
			pool.Buffer = nil
		}
	}
}
1316931
func (g Generationer) ResetStorageGeneration() error {
	var buf bytes.Buffer
	if _, err := io.CopyN(&buf, rand.Reader, 20); err != nil {
		return err
	}
	hex := fmt.Sprintf("%x", buf.Bytes())
	buf.Reset()
	buf.WriteString(hex)
	buf.WriteString(`

This file's random string on the first line is an optimization and
paranoia facility for clients.

If the client sees the same random string in multiple upload sessions,
it assumes that the blobserver still has all the same blobs, and also
it's the same server.  This mechanism is not fundamental to
Perkeep's operation: the client could also check each blob before
uploading, or enumerate all blobs from the server too.  This is purely
an optimization so clients can mix this value into their "is this file
uploaded?" local cache keys.

If you deleted any blobs (or suspect any were corrupted), it's best to
delete this file so clients can safely re-upload them.

`)

	return ioutil.WriteFile(g.generationFile(), buf.Bytes(), 0644)
}
1344809
func (p *TempFileProc) Reset() error {
	_, err := p.File.Seek(0, os.SEEK_SET)
	if err != nil {
		return &ResetError{err}
	}
	p.Buf.Reset(p.File)
	return nil
}
807575
func (alloc *Allocator) Reset(newBase int64) {
	atomic.StoreInt64(&alloc.base, newBase)
}
763577
func (s *Storage) Reset() {
	s.setBadger(storage.TotalCountKey, 0)
	s.setBadger(storage.IosSuccessKey, 0)
	s.setBadger(storage.IosErrorKey, 0)
	s.setBadger(storage.AndroidSuccessKey, 0)
	s.setBadger(storage.AndroidErrorKey, 0)
}
1109534
func (s *FloatEncoder) Reset() {
	s.val = 0
	s.err = nil
	s.leading = ^uint64(0)
	s.trailing = 0
	s.buf.Reset()
	s.buf.WriteByte(floatCompressedGorilla << 4)

	s.bw.Resume(0x0, 8)

	s.finished = false
	s.first = true
}
274492
func (d *DepthFirst) Reset() {
	d.stack = d.stack[:0]
	if d.visited != nil {
		d.visited.Clear()
	}
}
1336312
func (b *BitWriter) Reset(w io.Writer) {
	b.w = w
	b.b[0] = 0x00
	b.count = 8
}
944389
func (m *mysqlBackend) Reset() error {
	err := m.Drop()
	if err != nil {
		return err
	}
	databaseName, db, err := m.connectWithoutDB()
	if err != nil {
		return err
	}
	defer db.Close()
	_, err = db.Exec(`CREATE DATABASE ` + databaseName)
	return err
}
250430
func (p *ByteBlockPool) SetBytesRef(term *BytesRef, textStart int) {
	bytes := p.Buffers[textStart>>BYTE_BLOCK_SHIFT]
	term.Bytes = bytes
	pos := textStart & BYTE_BLOCK_MASK
	if (bytes[pos] & 0x80) == 0 {
		// length is 1 byte
		term.Length = int(bytes[pos])
		term.Offset = pos + 1
	} else {
		// length is 2 bytes
		term.Length = (int(bytes[pos]) & 0x7f) + ((int(bytes[pos+1]) & 0xff) << 7)
		term.Offset = pos + 2
	}
	assert(term.Length >= 0)
}
1204426
func (limiter *Limiter) Reset() {
	limiter.requestCount = 0
	for i := limiter.MaxConcurrentRequests; i > 0; i-- {
		limiter.Signal()
	}
}
733889
func (d *DefaultMetricCollector) Reset() {
	d.mutex.Lock()
	defer d.mutex.Unlock()

	d.numRequests = rolling.NewNumber()
	d.errors = rolling.NewNumber()
	d.successes = rolling.NewNumber()
	d.rejects = rolling.NewNumber()
	d.shortCircuits = rolling.NewNumber()
	d.failures = rolling.NewNumber()
	d.timeouts = rolling.NewNumber()
	d.fallbackSuccesses = rolling.NewNumber()
	d.fallbackFailures = rolling.NewNumber()
	d.contextCanceled = rolling.NewNumber()
	d.contextDeadlineExceeded = rolling.NewNumber()
	d.totalDuration = rolling.NewTiming()
	d.runDuration = rolling.NewTiming()
}
1318624
func (client *Client) ResetReplication(ctx context.Context, tablet *topodatapb.Tablet) error {
	cc, c, err := client.dial(tablet)
	if err != nil {
		return err
	}
	defer cc.Close()
	_, err = c.ResetReplication(ctx, &tabletmanagerdatapb.ResetReplicationRequest{})
	return err
}
194845
func (sba *sparseBitArray) Reset() {
	sba.blocks = sba.blocks[:0]
	sba.indices = sba.indices[:0]
}
605207
func (w *Writer) Reset() {
	w.mtx.Lock()
	defer w.mtx.Unlock()
	w.Buf.Reset()
	w.lineCount = 0
}