MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / list

Method list

cmd/cql-fuse/fs.go:155–174  ·  view source on GitHub ↗

list returns the children of the node with id 'parentID'. Dirent consists of: Inode uint64 Type DirentType (optional) Name string TODO(pmattis): lookup all inodes and fill in the type, this will save a Getattr().

(parentID uint64)

Source from the content-addressed store, hash-verified

153// Name string
154// TODO(pmattis): lookup all inodes and fill in the type, this will save a Getattr().
155func (cfs CFS) list(parentID uint64) ([]fuse.Dirent, error) {
156 rows, err := cfs.db.Query(`SELECT name, id FROM fs_namespace WHERE parentID = ?`, parentID)
157 if err != nil {
158 return nil, err
159 }
160
161 var results []fuse.Dirent
162 for rows.Next() {
163 dirent := fuse.Dirent{Type: fuse.DT_Unknown}
164 if err := rows.Scan(&dirent.Name, &dirent.Inode); err != nil {
165 return nil, err
166 }
167 results = append(results, dirent)
168 }
169 if err := rows.Err(); err != nil {
170 return nil, err
171 }
172
173 return results, nil
174}
175
176// validateRename takes a source and destination node and verifies that
177// a rename can be performed from source to destination.

Callers 1

ReadDirAllMethod · 0.80

Calls 3

QueryMethod · 0.65
NextMethod · 0.45
ScanMethod · 0.45

Tested by

no test coverage detected