hi
my company is thinking of using thrift for our product's "alient API". the
product itself it written in python and we'd like to expose our API to many
languages and platforms.
i started investigating thrift and stumbled across quite a major issue -- it
seems that thrift only passes objects by value, e.g., you instantiate a
struct and send it over the wire.
is there any way to pass a reference to a remote object? our product defines
classes like FileSystem or ScsiDevice, and it's not meaningful to pass them
by value.
what we need is to pass a reference or a handle to this object, so that we
could call methods on it.
suppose i have a service called StorageService that provides a method called
makeFS:
class FileSystem
{
string devname;
void mount(string path, int32 flags)
}
service StorageService
{
FileSystem makeFS(fs_type_enum fstype, string devname)
}
and then the user can connect to the StorageService, call makeFS, and
receive a proxy-object ("handle") to the real object, which of course
resides in a separate process, possibly on a different machine.
with this proxy object, the user could then call mount() and other methods.
basically, if i would generate java code from the above IDL (and pardon my
java, i haven't used it in a while), it would look something like:
class FileSystemProxy
{
private TConnection conn;
private int handle;
FileSystemProxy(TConnection conn, int handle) {
this.conn = conn;
this.handle = handle;
}
public void mount(string path, int fags) {
conn.call_method(handle, path, flags);
}
public string get_devname() {
return conn.get_property(handle, "devname");
}
public void set_devname(string value) {
conn.set_property(handle, "devname", value);
}
}
(something in that spirit, anyway)
then, when the user connects and calls the service' makeFS, he actually gets
an instance of FileSystemProxy.
on the wire, you only pass the handle (which is an integer or anything else
that uniquely identifies the remote object on the server).
so my question is -- is this a planned feature? a desired feature?
if our company is willing to implement such a feature (at least for java and
csharp), will it be welcomed?
thanks,
-tomer
An NCO and a Gentleman