[ 
https://issues.apache.org/jira/browse/OAK-392?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jukka Zitting updated OAK-392:
------------------------------

    Attachment: 0001-OAK-392-Review-ContentSession-createBlob.patch

I would treat uncommitted blobs as any other transient changes that may be 
purged to the underlying storage already at any point before a commit(), just 
as long as such content only becomes visible to other clients only *after* the 
commit().

That approach also suggest a clean way to deal with the lifetime of a blob: It 
will be valid at least until the associated ContentSession is closed, or longer 
if it was included in a commit before the session was closed. In the latter 
case the blob would remain valid until the related binary property gets removed 
and garbage collected.

Such tying of blobs to the originating session makes the {{BlobFactory}} 
interface less necessary and would make it more natural to put the 
{{createBlob()}} method back in {{ContentSession}} or {{Root}}. The attached 
patch does the latter, with the following clarification of the contract:

{code:java}
/**
 * Reads (and closes) the given stream and returns a {@link Blob} that
 * contains that binary. The returned blob will remain valid at least
 * until the {@link ContentSession} of this root is closed, or longer
 * if it has been committed as a part of a content update.
 * <p>
 * The implementation may decide to persist the blob at any point
 * during or between this method method call and a {@link #commit()}
 * that includes the blob, but the blob will become visible to other
 * sessions only after such a commit.
 *
 * @param stream the stream for reading the binary
 * @return the blob that was created
 * @throws IOException if the stream could not be read
 */
@Nonnull
Blob createBlob(@Nonnull InputStream stream) throws IOException;
{code}

> Review ContentSession#createBlob
> --------------------------------
>
>                 Key: OAK-392
>                 URL: https://issues.apache.org/jira/browse/OAK-392
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core, mk
>            Reporter: angela
>             Fix For: 0.12
>
>         Attachments: 0001-OAK-392-Review-ContentSession-createBlob.patch
>
>
> see also 
> http://markmail.org/message/xc2klids33vjjkud



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to