Replies: 1 comment 7 replies
-
This is of course not a nice solution for NFS clients, as then try to optimize IO requests based on the file size.... You can always return Long.MAX_VALUE ans the file size, and return less bytes and set EOF flag on read: bool eof = false;
final READ4res res = result.opread;
int n;
try {
n = vfs.read(...);
res
} catch (EOFException e) {
res.resok4.eof = true;
} You will need to implement a custom READ operation to use it: class CustomNFSv4OperationFactory extends MDSOperationExecutor {
@Override
protected AbstractNFSv4Operation getOperation(nfs_argop4 op) {
switch (op.argop) {
case nfs_opnum4.OP_READ:
return new CustomOperationREAD(op);
default:
return super.getOperation(op); |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Apologies if this is a newbie question - still figuring out the nitty-gritty details of NFS as well as the nfs4j implementation.
It seems nfs4j normally requires the server to know the size of files being accessed before the file data is fetched...when a client reads a file, the server seems to get the size, then calls the VFS layer to fetch precisely this much data.
Is there an alternative where the server can just read until it gets EOF from the VFS implementation? This is very handy when the underlying object isn't a filesystem object, but rather a pipe, a database query or some other "blob" where it's difficult or time-consuming to know the precise size involved ahead of time. What we're looking for (perhaps) is a way to set the size attribute to something like -1 (or not return it at all), then throw some sort of EOF exception to tell the system that a particular filehandle reached the end of its data.
Beta Was this translation helpful? Give feedback.
All reactions