func (t *TreeMemoryCache) UpdateUnderlying(cache TreeDatabase) error {
	t.lock.Lock()
	defer t.lock.Unlock()
	
	oldHash, err := t.Hash()
	if err != nil {
		return err
	}

	newHash, err := cache.Hash()
	if err != nil {
		return err
	}

	if !oldHash.IsEqual(newHash) {
		return fmt.Errorf("expected old store to match new store (old: %s, new: %s)", oldHash, newHash)
	}

	t.underlyingStore = cache
	return nil
}
// UpdateUnderlying updates the underlying store.
UpdateUnderlying updates the underlying store.
// UpdateUnderlying updates the underlying store .
func (t *TreeMemoryCache) UpdateUnderlying(cache TreeDatabase) error {
	t.lock.Lock()
	defer t.lock.Unlock()
	oldHash, err := t.Hash()
	if err != nil {
		return err
	}
	newHash, err := cache.Hash()
	if err != nil {
		return err
	}
	if !oldHash.IsEqual(newHash) {
		return fmt.Errorf("expected old store to match new store (old: %s, new: %s)", oldHash, newHash)
	}
	t.underlyingStore = cache
	return nil
}
func ( t * TreeMemoryCache ) UpdateUnderlying ( cache TreeDatabase ) error { t . lock . Lock ( ) defer t . lock . Unlock ( ) oldHash , err := t . Hash ( ) if err != nil { return err } newHash , err := cache . Hash ( ) if err != nil { return err } if ! oldHash . IsEqual ( newHash ) { return fmt . Errorf ( " " , oldHash , newHash ) } t . underlyingStore = cache return nil }
UpdateUnderlying updates the underlying store.
UpdateUnderlying updates the underlying store .