// Prev returns the currently enumerated item, if it exists and moves to the
// previous item in the key collation order. If there is no item to return, err
// == io.EOF is returned.
501935
func (e *enumerator) Prev() (k uint64, v *Container, err error) {
	if err = e.err; err != nil {
		return 0, nil, err
	}

	if e.ver != e.t.ver {
		f, _ := e.t.Seek(e.k)
		*e = *f
		f.Close()
	}
	if e.q == nil {
		e.err, err = io.EOF, io.EOF
		return 0, nil, err
	}

	if !e.hit {
		// move to previous because Seek overshoots if there's no hit
		if err = e.prev(); err != nil {
			return 0, nil, err
		}
	}

	if e.i >= e.q.c {
		if err = e.prev(); err != nil {
			return 0, nil, err
		}
	}

	i := e.q.d[e.i]
	k, v = i.k, i.v
	e.k, e.hit = k, true
	// Any error returned would be stashed in e.err, and would come up
	// on the next call.
	_ = e.prev()
	return k, v, err
}
714555
func (ev *ChangeResp) GetPrevValue(prevVal proto.Message) (prevExists bool, err error) {
	if prevVal != nil && ev.PrevVal != nil {
		return true, ev.PrevVal.GetValue(prevVal)
	}
	return false, err
}
1183001
func (alle *assetLruListElement) Prev() *assetLruListElement {
	if p := alle.prev; alle.list != nil && p != &alle.list.root {
		return p
	}
	return nil
}
561538
func (history *History) Less(i, j int) bool {
	containers := *history
	return containers[j].Created.Before(containers[i].Created)
}
669120
func (e *element) Prev() *element {
	if p := e.prev; e.list != nil && p != &e.list.root {
		return p
	}
	return nil
}
770013
func (ev *changePrev) GetPrevValue(prevVal proto.Message) (exists bool, err error) {
	if ev.prev != nil {
		return true, ev.prev.GetValue(prevVal)
	}
	return false, nil
}
1033422
func (c *Carbon) Previous(wd time.Weekday) *Carbon {
	c = c.SubDay()
	for c.Weekday() != wd {
		c = c.SubDay()
	}

	return c.StartOfDay()
}
1020874
func (e *CElement) Prev() *CElement {
	e.mtx.RLock()
	prev := e.prev
	e.mtx.RUnlock()
	return prev
}
195609
func (ci CellID) PrevWrap() CellID {
	p := ci.Prev()
	if uint64(p) < wrapOffset {
		return p
	}
	return CellID(uint64(p) + wrapOffset)
}
1228068
func (ev *ChangeWatchResp) GetPrevValue(prevVal proto.Message) (prevExists bool, err error) {
	if ev.message.OperationType == PutDel_DEL {
		return false, err
	}

	return false, err //TODO prev value
}
1054
func (l *List) Back() *Element {
	if l.len == 0 {
		return nil
	}
	return l.root.prev
}
691294
func (f Index) Last(prefix []byte) (i Item, err error) {
	it := f.db.NewIterator()
	defer it.Release()

	// get the next prefix in line
	// since leveldb iterator Seek seeks to the
	// next key if the key that it seeks to is not found
	// and by getting the previous key, the last one for the
	// actual prefix is found
	nextPrefix := incByteSlice(prefix)
	l := len(prefix)

	if l > 0 && nextPrefix != nil {
		it.Seek(append(f.prefix, nextPrefix...))
		it.Prev()
	} else {
		it.Last()
	}

	totalPrefix := append(f.prefix, prefix...)
	return f.itemFromIterator(it, totalPrefix)
}
339152
func (b *BlockGen) PrevBlock(index int) *types.Block {
	if index >= b.i {
		panic(fmt.Errorf("block index %d out of range (%d,%d)", index, -1, b.i))
	}
	if index == -1 {
		return b.parent
	}
	return b.chain[index]
}
946069
func (e *defaultStoreEnumerator) Enumerate(
	locator *api.VolumeLocator,
	labels map[string]string,
) ([]*api.Volume, error) {

	kvp, err := e.kvdb.Enumerate(e.volKeyPrefix())
	if err != nil {
		return nil, err
	}
	volumes := make([]*api.Volume, 0, len(kvp))
	for _, v := range kvp {
		elem := &api.Volume{}
		if err := json.Unmarshal(v.Value, elem); err != nil {
			return nil, err
		}
		if match(elem, locator, labels) {
			volumes = append(volumes, elem)
		}
	}
	return volumes, nil
}
263599
func (ec *Envcfg) Env() string {
	if env := ec.GetKey(ec.envKey); env != "" {
		return env
	}
	return DefaultEnvironment
}
590009
func (ctx *protoKeyIterator) GetNext() (key string, rev int64, stop bool) {
	return ctx.delegate.GetNext()
}
1051388
func (r *PrevRevisions) Get(key string) (found bool, value datasync.KeyVal) {
	r.mu.RLock()
	prev, found := r.revisions[key]
	r.mu.RUnlock()

	return found, prev
}