You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: buffer.go
    path of file: ./repos/cds/engine/cdn/storage/local
    
    the code of the file until where you have to start completion: package local

import (
	"context"
	"fmt"
	"os"
	"path/filepath"

	"github.com/go-gorp/gorp"
	"github.com/rockbears/log"

	"github.com/ovh/cds/engine/cdn/storage"
	"git
    
func (b *Buffer) ResyncWithDatabase(ctx context.Context, db gorp.SqlExecutor, t sdk.CDNItemType, dryRun bool) {
	root := fmt.Sprintf("%s/%s", b.config.Path, string(t))
	if err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
		if info == nil {
			return nil
		}
		if info.IsDir() {
			log.Warn(ctx, "local-buffer: found directory inside %s: %s", string(t), path)
			return nil
		}
		_, fileName := filepath.Split(path)
		has, err := storage.HashItemUnitByApiRefHash(db, fileName, b.ID())
		if err != nil {
			log.Error(ctx, "local-buffer: unable to check if unit item exist for api ref hash %s: %v", fileName, err)
			return nil
		}
		if has {
			return nil
		}
		if !dryRun {
			if err := os.Remove(path); err != nil {
				log.Error(ctx, "local-buffer: unable to remove file %s: %v", path, err)
				return nil
			}
			log.Info(ctx, "local-buffer: file %s has been deleted", fileName)
		} else {
			log.Info(ctx, "local-buffer: file %s should be deleted", fileName)
		}
		return nil
	}); err != nil {
		log.Error(ctx, "local-buffer: error during walk operation: %v", err)
	}

}