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: needle_map_metric.go
    path of file: ./repos/seaweedfs/weed/storage
    
    the code of the file until where you have to start completion: package storage

import (
	"fmt"
	"os"
	"sync/atomic"

	"github.com/seaweedfs/seaweedfs/weed/storage/idx"
	. "github.com/seaweedfs/seaweedfs/weed/storage/types"
	boom "github.com/tylertreat/BoomFilters"
)

type mapMetric struct {
	DeletionCounter     uint32 `json:"DeletionCounter"`
	FileCounter         uint32 `json:"FileCounter"`
	DeletionByteCounter uint64 `json:"DeletionByteCounter"`
	FileByteCounter     uint64 `json:"FileByteCounter"`
	MaximumFileKey      uint64 `json:"MaxFileKey"`
}

func (mm *mapMetric) logDelete(deletedByteCount Size) {
	if mm == nil {
		return

    
func needleMapMetricFromIndexFile(r *os.File, mm *mapMetric) error {
	var bf *boom.BloomFilter
	buf := make([]byte, NeedleIdSize)
	err := reverseWalkIndexFile(r, func(entryCount int64) {
		bf = boom.NewBloomFilter(uint(entryCount), 0.001)
	}, func(key NeedleId, offset Offset, size Size) error {

		mm.MaybeSetMaxFileKey(key)
		NeedleIdToBytes(buf, key)
		if size.IsValid() {
			mm.FileByteCounter += uint64(size)
		}

		mm.FileCounter++
		if !bf.TestAndAdd(buf) {
			// if !size.IsValid(), then this file is deleted already
			if !size.IsValid() {
				mm.DeletionCounter++
			}
		} else {
			// deleted file
			mm.DeletionCounter++
			if size.IsValid() {
				// previously already deleted file
				mm.DeletionByteCounter += uint64(size)
			}
		}
		return nil
	})
	return err
}