MCPcopy
hub / github.com/kopia/kopia / findAllEntries

Function findAllEntries

snapshot/upload/upload_test.go:200–221  ·  view source on GitHub ↗

findAllEntries recursively iterates over all the dirs and returns list of file entries.

(t *testing.T, ctx context.Context, dir fs.Directory)

Source from the content-addressed store, hash-verified

198
199// findAllEntries recursively iterates over all the dirs and returns list of file entries.
200func findAllEntries(t *testing.T, ctx context.Context, dir fs.Directory) []entry {
201 t.Helper()
202
203 entries := []entry{}
204
205 fs.IterateEntries(ctx, dir, func(ctx context.Context, e fs.Entry) error {
206 oid, err := object.ParseID(testutil.EnsureType[object.HasObjectID](t, e).ObjectID().String())
207 require.NoError(t, err)
208
209 entries = append(entries, entry{
210 name: e.Name(),
211 objectID: oid,
212 })
213 if e.IsDir() {
214 entries = append(entries, findAllEntries(t, ctx, testutil.EnsureType[fs.Directory](t, e))...)
215 }
216
217 return nil
218 })
219
220 return entries
221}
222
223func verifyMetadataCompressor(t *testing.T, ctx context.Context, rep repo.Repository, entries []entry, comp compression.HeaderID) {
224 t.Helper()

Callers 1

Calls 8

IterateEntriesFunction · 0.92
ParseIDFunction · 0.92
EnsureTypeFunction · 0.92
HelperMethod · 0.80
ObjectIDMethod · 0.65
NameMethod · 0.65
StringMethod · 0.45
IsDirMethod · 0.45

Tested by

no test coverage detected