Binary property stream wrapper #14

merged 6 commits into from Jun 28, 2011


None yet
2 participants

uwej711 commented Jun 27, 2011

Implementation of a stream wrapper to avoid loading binary data from the backend as long as the stream is not accessed. Tested with jackrabbit but should also work with other transports as it only calls ObjectManager::getBinaryStream()

uwej711 added some commits Jun 27, 2011

Implemented BinaryStreamWrapper for lazy loading
All streams for binary properties are wrapped for lazy loading since
fetching them from the backend requires an extra call.

can you please add an @Private annotation to public methods that are implementation specific?

you can remove the } else { as we have return before.


uwej711 replied Jun 27, 2011

Well, I thought it is clearer that way ... but no problem, I can remove it ...

dbu replied Jun 27, 2011

lukas was constantly cleaning those away from my code, and by now i got used to it and think it is a bit more readable actually :-)

i suggest removing the $session->isLive() check. then you get the error from the transport layer :-)
if you want it explicitly, you should do similar to the Client implementation of transport

            throw new \LogicException("Trying to read a stream from a closed transport.");

actually it could make sense to check session->isLive on every init_stream() call and explode if its no longer live. to prevent people from assuming they can continue stream operations (if you first do something that loads the stream and then close the session, it is "cached" in the wrapper). if at some point we implement streaming longer binary data (like, only get the first 10 MB or something) their code would break.

dbu commented on f6405bb Jun 27, 2011

great stuff, thanks uwe!

had some minor comments on doc.

uwej711 added a commit that referenced this pull request Jun 28, 2011

@uwej711 uwej711 merged commit 698fac9 into jackalope:master Jun 28, 2011

sixty-nine pushed a commit that referenced this pull request Oct 28, 2011

Jackalope Issue #14 - Renamed methods _and, _or and not in PHPCR\Quer…
…yObjectModelFactoryInterface to andConstraint, orConstraint and notConstraint + Correct version of phpcr-api tests and phpcr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment