From 35caceace4eb29ea34406861dc72067afd427bac Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Fri, 5 Jun 2026 15:26:26 +0200 Subject: [PATCH] restore: unexport HardlinkIndex.Index and hardlinkKey --- internal/restorer/hardlinks_index.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/restorer/hardlinks_index.go b/internal/restorer/hardlinks_index.go index 0fe426694..ec6c33a50 100644 --- a/internal/restorer/hardlinks_index.go +++ b/internal/restorer/hardlinks_index.go @@ -4,21 +4,21 @@ import ( "sync" ) -// HardlinkKey is a composed key for finding inodes on a specific device. -type HardlinkKey struct { +// hardlinkKey is a composed key for finding inodes on a specific device. +type hardlinkKey struct { Inode, Device uint64 } // HardlinkIndex maps inodes on devices to associated values. type HardlinkIndex[T any] struct { m sync.Mutex - Index map[HardlinkKey]T + index map[hardlinkKey]T } // NewHardlinkIndex create a new index for hard links func NewHardlinkIndex[T any]() *HardlinkIndex[T] { return &HardlinkIndex[T]{ - Index: make(map[HardlinkKey]T), + index: make(map[hardlinkKey]T), } } @@ -26,7 +26,7 @@ func NewHardlinkIndex[T any]() *HardlinkIndex[T] { func (idx *HardlinkIndex[T]) Has(inode uint64, device uint64) bool { idx.m.Lock() defer idx.m.Unlock() - _, ok := idx.Index[HardlinkKey{inode, device}] + _, ok := idx.index[hardlinkKey{inode, device}] return ok } @@ -35,10 +35,10 @@ func (idx *HardlinkIndex[T]) Has(inode uint64, device uint64) bool { func (idx *HardlinkIndex[T]) Add(inode uint64, device uint64, value T) { idx.m.Lock() defer idx.m.Unlock() - _, ok := idx.Index[HardlinkKey{inode, device}] + _, ok := idx.index[hardlinkKey{inode, device}] if !ok { - idx.Index[HardlinkKey{inode, device}] = value + idx.index[hardlinkKey{inode, device}] = value } } @@ -46,12 +46,12 @@ func (idx *HardlinkIndex[T]) Add(inode uint64, device uint64, value T) { func (idx *HardlinkIndex[T]) Value(inode uint64, device uint64) T { idx.m.Lock() defer idx.m.Unlock() - return idx.Index[HardlinkKey{inode, device}] + return idx.index[hardlinkKey{inode, device}] } // Remove removes a link from the index. func (idx *HardlinkIndex[T]) Remove(inode uint64, device uint64) { idx.m.Lock() defer idx.m.Unlock() - delete(idx.Index, HardlinkKey{inode, device}) + delete(idx.index, hardlinkKey{inode, device}) }