You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, there's no direct method to get file statistics (Stat()) from the Charm Cloud server without downloading the entire file. This is inefficient, especially for large files. Additionally, there's a discrepancy in file sizes reported by different methods.
Current Behavior
Using Open() and Stat() downloads the entire file before returning file stats, which is slow for large files.
ReadDir() method is faster but doesn't provide a direct way to get stats for a specific file.
File sizes returned by ReadDir() and Open()+Stat() are inconsistent and differ from the actual file size.
Desired Behavior
Implement a direct Stat() method that fetches file statistics from the Charm Cloud server without downloading the file.
Ensure consistency in file sizes reported by all methods.
2024-07-19T20:45:46.518+0800 INFO trycm/charm.go:406 Read file stat slow {"pid": 13376, "time_cost": "12.397896964s", "path": "sub/wtf.mp4", "is_dir": false, "name": "wtf.mp4", "size": 13069634, "mode": "-rw-r--r--", "mod_time": "2024-07-19T12:07:35.000Z"}
2024-07-19T20:45:46.860+0800 INFO trycm/charm.go:415 Read file stat fast {"pid": 13376, "time_cost": "338.782084ms", "path": "sub/wtf.mp4", "is_dir": false, "name": "wtf.mp4", "size": 13072989, "mode": "-rw-r--r--", "mod_time": "2024-07-19T12:07:35.325Z"}
File Size Discrepancy
Actual file size (from local file system):
❯ ls -last wtf.mp4
25528 -rw-r--r--@ 1 dev staff 13069634 Jan 27 10:40 wtf.mp4
The size reported by ReadDir() (13072989 bytes) differs from both the actual file size and the size reported by Open()+Stat() (13069634 bytes).
Proposed Solution
Implement a direct Stat() method in the Charm Cloud server that returns file statistics without downloading the file.
Investigate and fix the file size discrepancy to ensure all methods return the correct file size.
Additional Notes
This enhancement would significantly improve performance for applications that need to frequently check file metadata without downloading the entire file content.
The text was updated successfully, but these errors were encountered:
Currently, there's no direct method to get file statistics (Stat()) from the Charm Cloud server without downloading the entire file. This is inefficient, especially for large files. Additionally, there's a discrepancy in file sizes reported by different methods.
Current Behavior
Open()
andStat()
downloads the entire file before returning file stats, which is slow for large files.ReadDir()
method is faster but doesn't provide a direct way to get stats for a specific file.ReadDir()
andOpen()
+Stat()
are inconsistent and differ from the actual file size.Desired Behavior
Stat()
method that fetches file statistics from the Charm Cloud server without downloading the file.Code Example
Current solution and workaround using
ReadDir()
:Performance Comparison
Testing code:
File Size Discrepancy
Actual file size (from local file system):
The size reported by
ReadDir()
(13072989 bytes) differs from both the actual file size and the size reported byOpen()
+Stat()
(13069634 bytes).Proposed Solution
Stat()
method in the Charm Cloud server that returns file statistics without downloading the file.Additional Notes
This enhancement would significantly improve performance for applications that need to frequently check file metadata without downloading the entire file content.
The text was updated successfully, but these errors were encountered: