What kind of Service should I define for \".thrift\"-file to use it later for my Program?
This File Transport should be between the Client and the Server and it shou
Your code looks not so bad to me (not tested) and there is not much to change.
How about
typedef binary binar
service StreamFileService {
binar getBytes(1:string fileName, 2: i64 offset, 3: i32 size);
i64 getSize(1:string fileName)
}
I would also return a struct holding the bytes, but that's more or less my personal opinion.
struct FileChunk {
1: binary data
2: i64 remaining
}
service StreamFileService {
FileChunk getBytes(1:string fileName, 2: i64 offset, 3: i32 size);
}
The FileChunk
struct can be easily extended, if such becomes necessary, e.g. in order to return additional metadata, like total size (especially if the size grows/shrinks over time), remaining bytes, indications about the data format, or the like. You don't have to do that, as you can easily extend the interface if such becomes necessary later. Matter of taste.