Skip to content

Commit 20a2e6d

Browse files
committed
Let inMemoryPrepopulatedDirectory forward VirtualApply() calls
InitialContentsFetcher already has a VirtualApply() method, which is used by bb_clientd to efficiently extract the set of containing digests of a directory. This functionality is currently only available through FilterChildren(). This change makes it possible to call into the InitialContentsFetcher directly, without going through FilterChildren. This will be useful as part of bonanza_worker, where we want to call into VirtualApply() to prevent unnecessary computation of directory Merkle trees.
1 parent ca77ec1 commit 20a2e6d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/filesystem/virtual/in_memory_prepopulated_directory.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,14 @@ func (i *inMemoryPrepopulatedDirectory) virtualGetAttributesLocked(requested Att
738738
attributes.SetLastDataModificationTime(i.contents.lastDataModificationTime)
739739
}
740740

741-
func (inMemoryPrepopulatedDirectory) VirtualApply(data any) bool {
741+
func (i *inMemoryPrepopulatedDirectory) VirtualApply(data any) bool {
742+
i.lock.Lock()
743+
initialContentsFetcher := i.initialContentsFetcher
744+
i.lock.Unlock()
745+
746+
if initialContentsFetcher != nil {
747+
return initialContentsFetcher.VirtualApply(data)
748+
}
742749
return false
743750
}
744751

0 commit comments

Comments
 (0)