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
LabelsReader should implement the io.ReadSeekCloser interface and only ever open one file on the disk at a time. NewLabelsReader should receive the directory of containing the PoST data, do some basic checks of the existing files against the postmeta_data.json and then abstract the directory for the user of the object to treat it as if it was a single file.
Read and Seek should only ever open one file and if the file cannot be found or is smaller then expected return io.ErrUnexpectedEOF.
Writer
Similar to the Reader LabelsWriter should implement the io.WriteSeekCloser interface and transparently handle the writing of data to multiple files.
This would among others remove the need to handle individual files by the initializer.
Additional note
At the moment Diskstate does not stat files to get their file size but rather uses fs.DirEntry::Info() which reports an incorrect size if the PoST data directory contains soft-links to the files (e.g. on other disks). On linux this problem can be solved by instead stating the files with os.Stat to get their correct size. On other OSes this might work differently and needs to be tested.
The text was updated successfully, but these errors were encountered:
Reader
LabelsReader
should implement theio.ReadSeekCloser
interface and only ever open one file on the disk at a time.NewLabelsReader
should receive the directory of containing the PoST data, do some basic checks of the existing files against thepostmeta_data.json
and then abstract the directory for the user of the object to treat it as if it was a single file.Read
andSeek
should only ever open one file and if the file cannot be found or is smaller then expected returnio.ErrUnexpectedEOF
.Writer
Similar to the Reader
LabelsWriter
should implement theio.WriteSeekCloser
interface and transparently handle the writing of data to multiple files.This would among others remove the need to handle individual files by the initializer.
Additional note
At the moment
Diskstate
does not stat files to get their file size but rather usesfs.DirEntry::Info()
which reports an incorrect size if the PoST data directory contains soft-links to the files (e.g. on other disks). On linux this problem can be solved by instead stating the files withos.Stat
to get their correct size. On other OSes this might work differently and needs to be tested.The text was updated successfully, but these errors were encountered: