func (iter *dbCacheIterator) skipPendingUpdates(forwards bool) {
	for iter.dbIter.Valid() {
		var skip bool
		key := iter.dbIter.Key()
		if iter.cacheSnapshot.pendingRemove.Has(key) {
			skip = true
		} else if iter.cacheSnapshot.pendingKeys.Has(key) {
			skip = true
		}
		if !skip {
			break
		}
		if forwards {
			iter.dbIter.Next()
		} else {
			iter.dbIter.Prev()
		}
	}
}
skipPendingUpdates skips any keys at the current database iterator position
that are being updated by the cache.  The forwards flag indicates the
direction the iterator is moving.
package ffldb
import (
	"bytes"
	"fmt"
	"sync"
	"time"
	"github.com/soteria-dag/soterd/database/internal/treap"
	"github.com/btcsuite/goleveldb/leveldb"
	"github.com/btcsuite/goleveldb/leveldb/iterator"
	"github.com/btcsuite/goleveldb/leveldb/util"
)
const (
	defaultCacheSize = 100 * 1024 * 1024  
	defaultFlushSecs = 300  
	ldbBatchHeaderSize = 12
	ldbRecordIKeySize  = 8
)
type ldbCacheIter struct {
	*treap.Iterator
}
var _ iterator.Iterator = (*ldbCacheIter)(nil)
func (iter *ldbCacheIter) Error() error {
	return nil
}
func (iter *ldbCacheIter) SetReleaser(releaser util.Releaser) {
}
func (iter *ldbCacheIter) Release() {
}
func newLdbCacheIter(snap *dbCacheSnapshot, slice *util.Range) *ldbCacheIter {
	iter := snap.pendingKeys.Iterator(slice.Start, slice.Limit)
	return &ldbCacheIter{Iterator: iter}
}
type dbCacheIterator struct {
	cacheSnapshot *dbCacheSnapshot
	dbIter        iterator.Iterator
	cacheIter     iterator.Iterator
	currentIter   iterator.Iterator
	released      bool
}
var _ iterator.Iterator = (*dbCacheIterator)(nil)