[infinispan-dev] ISPN-78 and Large Object Support/Streaming API

Bela Ban bban at redhat.com
Tue May 25 06:56:26 EDT 2010



Philippe Van Dyck wrote:
> It may sound a bit extreme but what about using streams as the base
> interface and converting values to streams asap ?
>
> The conversion could be seen as the marshaling operation and the 
> result as a
> stream of bytes ?
>
> The 'base' interface would be as simple as:
> OutputStream<byte[]> get(K)
> put(K, InputStream<byte[]>)

I like this. Given an appropriate chunk size, I can envisage code like this:

cache.put("goldfinger", new 
FileInputStream("/home/bela/bond_movies/goldfinger.iso"));

and my movie would be chunked up and stored in the grid (Infinispan 
would close the input stream).

Maybe we should also offer some helper methods, similar to the UNIX 
system call 'sendfile', e.g.

void getAndStore(K key, String filename),

which retrieves data from the cache and stores it in the file system, 
ie. as syntactic sugar around

OutputStream out=new FileOutputStream("/home/bela/tmp.iso");
OutputStream output=cache.get("goldfinger");
// transfer output --> out and close out






-- 
Bela Ban
Lead JGroups / Clustering Team
JBoss


More information about the infinispan-dev mailing list