Add Function: ParseNilFile() for NIL file
Closed this issue · 4 comments
Purpose
To read the intent log in the NIL file to see if Hermes was restarted during a file operation.
Function Prototype
func ParseNilFile(file io.Reader) (struct fileIntent{ operation int, filename string}, error)
I think you probably need a different function signature here. From what I can understand above your function signature is
func ReadNilFile() (error, io.Reader)
I'm not sure this will work, because you need to pass in the file system you're reading, and what you expect the nil file to be called, and the path to it. Would something like
func ParseNilFile(file io.Reader) (struct fileIntent{ Operation int, Filename string}, error)
You then make the probe responsible for actually getting the nil file, and passing it to you, and share only the code to understand it?
That makes much more sense than what I had been thinking, thank you for clarifying that.
That also reduces the scope of the function which is great.
I have updated the issue with the function prototype.
Should nil file parsing not be shared, rather than per plugin?
Not relevant due to re-design and Nil file being stored as a proto.