MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / getDirEntries

Function getDirEntries

server/s3/utils.go:45–65  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

43}
44
45func getDirEntries(path string) ([]model.Obj, error) {
46 ctx := context.Background()
47 meta, _ := op.GetNearestMeta(path)
48 fi, err := fs.Get(context.WithValue(ctx, conf.MetaKey, meta), path, &fs.GetArgs{})
49 if errs.IsNotFoundError(err) {
50 return nil, gofakes3.ErrNoSuchKey
51 } else if err != nil {
52 return nil, gofakes3.ErrNoSuchKey
53 }
54
55 if !fi.IsDir() {
56 return nil, gofakes3.ErrNoSuchKey
57 }
58
59 dirEntries, err := fs.List(context.WithValue(ctx, conf.MetaKey, meta), path, &fs.ListArgs{})
60 if err != nil {
61 return nil, err
62 }
63
64 return dirEntries, nil
65}
66
67// func getFileHashByte(node interface{}) []byte {
68// b, err := hex.DecodeString(getFileHash(node))

Callers 1

entryListRMethod · 0.85

Calls 5

GetNearestMetaFunction · 0.92
GetFunction · 0.92
IsNotFoundErrorFunction · 0.92
ListFunction · 0.92
IsDirMethod · 0.65

Tested by

no test coverage detected