none
How do I read the last block from an azure cloudappendblob?

    Question

  • From @Merrion via Twitter:

    I have created a CloudAppendBlob to which I am appending each record as a blob.

    Now I just want to read the most recent (last) block appended to that blob.  Any ideas how I'd do that - there doesn't seem to be anything on the usual internet sources.

    What I have tried:

    I can read the whole blob to a stream thus:-
    Private Function GetUnderlyingStream() As System.IO.Stream

        If (AppendBlob IsNot Nothing) Then
            Dim targetStream As New System.IO.MemoryStream()
            Try
                GetAppendBlobSnapshot().DownloadToStream(targetStream)
            Catch exBlob As Microsoft.WindowsAzure.Storage.StorageException
                Throw New EventStreamReadException(DomainName, AggregateClassName, m_key.ToString(), 0, "Unable to access underlying event stream", exBlob)
            End Try
            targetStream.Seek(0, IO.SeekOrigin.Begin)
            Return targetStream
        Else
            Return Nothing
        End If

    End Function

    Maybe there is some way to get the offset of the last block only? 

    Thanks!
    @AzureSupport

      
    Tuesday, July 12, 2016 5:32 PM

Answers

All replies