// Reset resets the state of the traverser for reuse.
339435
func (b *BreadthFirst) Reset() {
	b.queue.Reset()
	if b.visited != nil {
		b.visited.Clear()
	}
}
44027
func (bs *BaseService) Reset() error {
	if !atomic.CompareAndSwapUint32(&bs.stopped, 1, 0) {
		bs.Logger.Debug(fmt.Sprintf("Can't reset %v. Not stopped", bs.name), "impl", bs.impl)
		return fmt.Errorf("can't reset running %s", bs.name)
	}

	// whether or not we've started, we can reset
	atomic.CompareAndSwapUint32(&bs.started, 1, 0)

	bs.quit = make(chan struct{})
	return bs.impl.OnReset()
}
1143428
func (c *Cache) Reset() {
	c.Lock()
	defer c.Unlock()
	c.m = make(map[string]*list.Element, c.config.MaxItems)
	c.l.Init()
	c.size = 0
}
1261431
func (c *chain) Reset() {
	for i, l := range c.link {
		if l.t != nil {
			l.t.Reset()
		}
		c.link[i].p, c.link[i].n = 0, 0
	}
}
29176
func (r *SimulationRep) Reset() error {
	r.lock.Lock()
	defer r.lock.Unlock()

	r.lrps = map[string]rep.LRP{}
	r.tasks = map[string]rep.Task{}
	r.startingContainerCount = 0
	return nil
}
944346
func (s *ShapeIndex) Reset() {
	s.shapes = make(map[int32]Shape)
	s.nextID = 0
	s.cellMap = make(map[CellID]*ShapeIndexCell)
	s.cells = nil
	atomic.StoreInt32(&s.status, fresh)
}
1125290
func (a *AccountState) Reset(mctx libkb.MetaContext) {
	a.Lock()
	defer a.Unlock()

	a.refreshReqs = nil
	a.done = true
}
1083951
func (iter *Iterator) Reset(reader io.Reader) *Iterator {
	iter.reader = reader
	iter.head = 0
	iter.tail = 0
	return iter
}
1146680
func (cache *mapTxCache) Reset() {
	cache.mtx.Lock()
	cache.map_ = make(map[[sha256.Size]byte]*list.Element, cache.size)
	cache.list.Init()
	cache.mtx.Unlock()
}
49648
func (s *scanner) reset() {
	s.step = stateBeginValue
	s.parseState = s.parseState[0:0]
	s.err = nil
	s.endTop = false
}
909507
func (c *Continuum) Reset(buckets []Bucket) {
	numbuckets := len(buckets)

	ring := make(points, 0, numbuckets*160)

	if numbuckets == 0 {
		c.ring = ring
		return
	}

	totalweight := uint32(0)
	for _, b := range buckets {
		totalweight += b.Weight()
	}

	for i, b := range buckets {
		pct := float32(b.Weight()) / float32(totalweight)

		// this is the equivalent of C's promotion rules, but in Go, to maintain exact compatibility with the C library
		limit := int(float32(float64(pct) * 40.0 * float64(numbuckets)))

		for k := 0; k < limit; k++ {
			/* 40 hashes, 4 numbers per hash = 160 points per bucket */
			ss := fmt.Sprintf("%s-%d", b.Label(), k)
			digest := md5.Sum([]byte(ss))

			for h := 0; h < 4; h++ {
				point := continuumPoint{
					point:  binary.LittleEndian.Uint32(digest[h*4:]),
					bucket: buckets[i],
				}
				ring = append(ring, point)
			}
		}
	}

	sort.Sort(ring)

	c.ring = ring
	c.buckets = buckets
}
613496
func (s *Stream) Reset() error {
	err := s.stream.Reset()
	s.state.Lock()
	switch s.state.v {
	case streamOpen, streamCloseRead, streamCloseWrite:
		s.state.v = streamReset
		s.remove()
	}
	s.state.Unlock()
	return err
}
830285
func (m Migrator) Reset() error {
	err := m.Down(-1)
	if err != nil {
		return errors.WithStack(err)
	}
	return m.Up()
}
920898
func (n *NodeDevice) Reset() error {
	var err C.virError
	result := C.virNodeDeviceResetWrapper(n.ptr, &err)
	if result == -1 {
		return makeError(&err)
	}
	return nil
}
908116
func (c *Cacher) Reset(data map[string]interface{}) {
	c.mu.Lock()
	defer c.mu.Unlock()
	c.data = data
}
417729
func (s *MemorySession) Reset() error {
	// reset counter and stores
	s.Counter.Reset()
	s.Incoming.Reset()
	s.Outgoing.Reset()

	return nil
}
1091596
func (r *Reader) Reset() {
	if r.structTypeRef != nil {
		r.structTypeRef = r.structTypeRef[:0]
	}
	if r.fieldsRef != nil {
		r.fieldsRef = r.fieldsRef[:0]
	}
	if r.Simple {
		return
	}
	if r.ref != nil {
		r.ref = r.ref[:0]
	}
}