That's pretty much what disconnected afs does. It took a grad student a year or two to write and is thousands of lines of code. A readonly version would be easier but it's still far from trivial.