Skip to content

Commit d1ce0d5

Browse files
authored
Tweak lookup call (#28)
* tweak lookup call * debug * remove outer check? * remove tweak * add dir check * debug logs * more debug logs * check * log attrs * check attr * return correct hash * clean up and better comment * add method to client instead * add path * add logs * more logs * add fsid log * more logs * remove logs * remove logs and rename
1 parent f9ffbdb commit d1ce0d5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pkg/blobfs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func updateReadAheadKB(mountPoint string, valueKB int) error {
183183
// Update read_ahead_kb
184184
cmd := exec.Command("sh", "-c", fmt.Sprintf("echo %d > %s", valueKB, readAheadPath))
185185
if err := cmd.Run(); err != nil {
186-
return fmt.Errorf("failed to update read_ahead_kb: %w", err)
186+
return fmt.Errorf("failed to update read_ahead_kb: %w read_ahead_path: %s", err, readAheadPath)
187187
}
188188

189189
return nil

pkg/client.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,3 +585,13 @@ func (c *BlobCacheClient) GetState() error {
585585

586586
return nil
587587
}
588+
589+
func (c *BlobCacheClient) IsPathCachedNearby(ctx context.Context, path string) bool {
590+
metadata, err := c.metadata.GetFsNode(ctx, GenerateFsID(path))
591+
if err != nil {
592+
Logger.Errorf("error getting fs node: %v, path: %s", err, path)
593+
return false
594+
}
595+
596+
return c.IsCachedNearby(ctx, metadata.Hash)
597+
}

0 commit comments

Comments
 (0)