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

Function getInode

cmd/cql-fuse/sql.go:54–65  ·  view source on GitHub ↗

getInode looks up an inode given its name and its parent ID. If not found, error will be sql.ErrNoRows.

(e sqlExecutor, parentID uint64, name string)

Source from the content-addressed store, hash-verified

52// getInode looks up an inode given its name and its parent ID.
53// If not found, error will be sql.ErrNoRows.
54func getInode(e sqlExecutor, parentID uint64, name string) (*Node, error) {
55 var raw string
56 const sql = `SELECT inode FROM fs_inode WHERE id =
57(SELECT id FROM fs_namespace WHERE (parentID, name) = (?, ?))`
58 if err := e.QueryRow(sql, parentID, name).Scan(&raw); err != nil {
59 return nil, err
60 }
61
62 node := &Node{}
63 err := json.Unmarshal([]byte(raw), node)
64 return node, err
65}
66
67// checkIsEmpty returns nil if 'id' has no children.
68func checkIsEmpty(e sqlExecutor, id uint64) error {

Callers 2

lookupMethod · 0.85
renameMethod · 0.85

Calls 3

QueryRowMethod · 0.80
UnmarshalMethod · 0.80
ScanMethod · 0.45

Tested by

no test coverage detected