Understanding provider.Walk #21
-
Hello @mouuff I'm planning on writing a new provider for my own use case, and I'm trying to get the the mindset right. From my initial study it appears to always fallback to the local provider walk. Also, I'm not really getting why you decoupled Walk and Retrieve. Just ideas to better understand the intended flow. Anyway, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello, Can you explain the reasoning behind the Walk function? it appears to always fallback to the local provider walk Also, I'm not really getting why you decoupled Walk and Retrieve: |
Beta Was this translation helpful? Give feedback.
Hello,
Thank you for your interest in this project!
Can you explain the reasoning behind the Walk function?
The walk method provides a way to iterate the files that can be retrieved from the provider.
To call the walk method you must pass a
func(info *FileInfo) error
which will be called for each file, giving information about each file.(Currently just
path
andmode
)FYI the
path
inFileInfo
is relative to the provider, it is not a system path (for example: just/something.exe
, then you can call retrieve on/something.exe
if you want)it appears to always fallback to the local provider walk
You are right, very often we just call the local provider. This is because most providers at the m…