It does, if we then have some additional method to seal-off / make-immutable that stream /
big-object.
e.g.
void closeFinally(K key); // method name is taken from GAE's FileWriteChannel
Which then probably calls for check method
boolean isOpen(K key);
I would also need a way to lock access per Key,
but I guess Infinispan already knows how to to this?
(probably in this case it would have to know the Key's sub-Keys of all pieces and lock
them?)
boolean lock(K key); // true if the lock succeeded
Or perhaps with timeout as well
boolean lock(K key, long time, TimeUnit unit); // true if the lock succeeded
and of course: void unlock(K key);
-Ales
Hi Ales,
yes, that sounds reasonable. In fact, I have been worrying about the
user relinquishing control over how Infinispan handles streaming large
objects. One quick question, though: I envisaged
OutputStream writeToKey(K key)
to be the "standard" way of streaming large objects into Infinispan.
Doesn't it fit your bill?
- Olaf
Am 14.10.11 22:29, schrieb Ales Justin:
> @Olaf:
>
> Looking at the API you proposed
> / public interface StreamingHandler<K> {//
> / / void writeToKey(K key, InputStream largeObject);//
> // OutputStream writeToKey(K key);//
> // InputStream readFromKey(K key);//
> // boolean removeKey(K key);//
> // StreamingHandler<K> //withFlags(Flag... flags//);
> // }/
>
> and what I actually need:
> *
>
http://code.google.com/p/googleappengine/source/browse/trunk/java/src/mai...
> --> see openRecordWriteChannel and openRecordReadChannel
>
> Where the read has a way of jumping back&forth in the channel,
> and write can seal the written bytes with closeFinally.
> *
>
http://code.google.com/p/googleappengine/source/browse/trunk/java/src/mai...
> *
>
http://code.google.com/p/googleappengine/source/browse/trunk/java/src/mai...
>
> Hence I guess we could change it to
>
> Closeable writeToKey(K key, InputStream largeObject); -- returning a
> handle to seal off (making it immutable from then on)
>
> InputStream readFromKey (K key, long position); -- also taking
> position into consideration
>
> Wdyt?
>
> (unfortunately I also don't have the time to help with impl,
> but I'm definitely willing to test it (since I need it anyway, right :-)))
>
> -Ales