public new static void UpdateBinaryProperty(BinaryDataValue value) { BlobStorageBase.UpdateBinaryProperty(value); }
public new static IBlobProvider GetProvider(long fullSize) { return(BlobStorageBase.GetProvider(fullSize)); }
public new static Task InsertBinaryPropertyAsync(BinaryDataValue value, int versionId, int propertyTypeId, bool isNewNode, SnDataContext dataContext) { return(BlobStorageBase.InsertBinaryPropertyAsync(value, versionId, propertyTypeId, isNewNode, dataContext)); }
public new static Task CommitChunkAsync(int versionId, int propertyTypeId, string token, long fullSize, BinaryDataValue source, CancellationToken cancellationToken) { return(BlobStorageBase.CommitChunkAsync(versionId, propertyTypeId, token, fullSize, source, cancellationToken)); }
/*================================================================== Maintenance*/ public new static Task CleanupFilesSetFlagAsync(CancellationToken cancellationToken) { return(BlobStorageBase.CleanupFilesSetFlagAsync(cancellationToken)); }
public new static Task <BinaryCacheEntity> LoadBinaryCacheEntityAsync(int nodeVersionId, int propertyTypeId, SnDataContext dataContext) { return(BlobStorageBase.LoadBinaryCacheEntityAsync(nodeVersionId, propertyTypeId, dataContext)); }
public new static Task <string> StartChunkAsync(int versionId, int propertyTypeId, long fullSize, CancellationToken cancellationToken) { return(BlobStorageBase.StartChunkAsync(versionId, propertyTypeId, fullSize, cancellationToken)); }
public new static void WriteChunk(int versionId, string token, byte[] buffer, long offset, long fullSize) { BlobStorageBase.WriteChunk(versionId, token, buffer, offset, fullSize); }
public new static void CommitChunk(int versionId, int propertyTypeId, string token, long fullSize, BinaryDataValue source = null) { BlobStorageBase.CommitChunk(versionId, propertyTypeId, token, fullSize, source); }
public new static byte[] LoadBinaryFragment(int fileId, long position, int count) { return(BlobStorageBase.LoadBinaryFragment(fileId, position, count)); }
public new static string StartChunk(int versionId, int propertyTypeId, long fullSize) { return(BlobStorageBase.StartChunk(versionId, propertyTypeId, fullSize)); }
public new static BinaryCacheEntity LoadBinaryCacheEntity(int nodeVersionId, int propertyTypeId) { return(BlobStorageBase.LoadBinaryCacheEntity(nodeVersionId, propertyTypeId)); }
public new static BlobStorageContext GetBlobStorageContext(int fileId, bool clearStream = false, int versionId = 0, int propertyTypeId = 0) { return(BlobStorageBase.GetBlobStorageContext(fileId, clearStream, versionId, propertyTypeId)); }
public new static void DeleteBinaryProperty(int versionId, int propertyTypeId) { BlobStorageBase.DeleteBinaryProperty(versionId, propertyTypeId); }
public new static Task <BinaryDataValue> LoadBinaryPropertyAsync(int versionId, int propertyTypeId, SnDataContext dataContext) { return(BlobStorageBase.LoadBinaryPropertyAsync(versionId, propertyTypeId, dataContext)); }
public new static void CopyFromStream(int versionId, string token, Stream input) { BlobStorageBase.CopyFromStream(versionId, token, input); }
public new static Task <BinaryCacheEntity> LoadBinaryCacheEntityAsync(int nodeVersionId, int propertyTypeId, CancellationToken cancellationToken) { return(BlobStorageBase.LoadBinaryCacheEntityAsync(nodeVersionId, propertyTypeId, cancellationToken)); }
/*================================================================== Maintenance*/ public new static void CleanupFilesSetFlag() { BlobStorageBase.CleanupFilesSetFlag(); }
public new static Task <byte[]> LoadBinaryFragmentAsync(int fileId, long position, int count, CancellationToken cancellationToken) { return(BlobStorageBase.LoadBinaryFragmentAsync(fileId, position, count, cancellationToken)); }
public new static bool CleanupFiles() { return(BlobStorageBase.CleanupFiles()); }
public new static Task WriteChunkAsync(int versionId, string token, byte[] buffer, long offset, long fullSize, CancellationToken cancellationToken) { return(BlobStorageBase.WriteChunkAsync(versionId, token, buffer, offset, fullSize, cancellationToken)); }
public override int Read(byte[] buffer, int offset, int count) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); } if (offset + count > buffer.Length) { throw new ArgumentException("Offset + count must not be greater than the buffer length."); } if (offset < 0) { throw new ArgumentOutOfRangeException(nameof(offset), "The offset must be greater than zero."); } if (count < 0) { throw new ArgumentOutOfRangeException(nameof(count), "The count must be greater than zero."); } // Calculate the maximum count of the bytes that can be read. // Return immediately if nothing to read. var maximumReadableByteCount = Length - Position; if (maximumReadableByteCount < 1) { return(0); } var realCount = (int)Math.Min(count, maximumReadableByteCount); if (CanInnerBufferHandleReadRequest(realCount)) { Array.Copy(_innerBuffer, (int)Position - _innerBufferFirstPostion, buffer, offset, realCount); } else { _innerBuffer = null; var bytesRead = 0; var bytesStoredInInnerBuffer = 0; while (bytesRead < realCount) { // bytes to load from the db var bytesToReadInThisIteration = (int)Math.Min(this.Length - Position - bytesRead, BlobStorage.BinaryChunkSize); // bytes that we will copy to the buffer of the caller var bytesToStoreInThisIteration = Math.Min(bytesToReadInThisIteration, realCount - bytesRead); // stores the current chunk var tempBuffer = BlobStorageBase.LoadBinaryFragmentAsync(this.FileId, Position + bytesRead, bytesToReadInThisIteration, CancellationToken.None).GetAwaiter().GetResult(); // first iteration: create inner buffer for caching a part of the stream in memory if (_innerBuffer == null) { _innerBuffer = new byte[GetInnerBufferSize(realCount)]; _innerBufferFirstPostion = Position; } // store a fragment of the data in the inner buffer if possible if (bytesStoredInInnerBuffer < _innerBuffer.Length) { var bytesToStoreInInnerBuffer = Math.Min(bytesToReadInThisIteration, _innerBuffer.Length - bytesStoredInInnerBuffer); Array.Copy(tempBuffer, 0, _innerBuffer, bytesStoredInInnerBuffer, bytesToStoreInInnerBuffer); bytesStoredInInnerBuffer += bytesToStoreInInnerBuffer; } // copy the chunk from the temp buffer to the buffer of the caller Array.Copy(tempBuffer, 0, buffer, bytesRead, bytesToStoreInThisIteration); bytesRead += bytesToReadInThisIteration; } } Position += realCount; return(realCount); }
public new static Task CopyFromStreamAsync(int versionId, string token, Stream input, CancellationToken cancellationToken) { return(BlobStorageBase.CopyFromStreamAsync(versionId, token, input, cancellationToken)); }
public new static Task DeleteBinaryPropertyAsync(int versionId, int propertyTypeId, SnDataContext dataContext) { return(BlobStorageBase.DeleteBinaryPropertyAsync(versionId, propertyTypeId, dataContext)); }
public new static Task <bool> CleanupFilesAsync(CancellationToken cancellationToken) { return(BlobStorageBase.CleanupFilesAsync(cancellationToken)); }
public new static Task DeleteBinaryPropertiesAsync(IEnumerable <int> versionIds, SnDataContext dataContext) { return(BlobStorageBase.DeleteBinaryPropertiesAsync(versionIds, dataContext)); }
public new static IBlobProvider GetProvider(string providerName) { return(BlobStorageBase.GetProvider(providerName)); }
public static Task <BlobStorageContext> GetBlobStorageContextAsync(int fileId, CancellationToken cancellationToken, bool clearStream = false, int versionId = 0, int propertyTypeId = 0) { return(BlobStorageBase.GetBlobStorageContextAsync(fileId, clearStream, versionId, propertyTypeId, cancellationToken)); }
public new static Task UpdateBinaryPropertyAsync(BinaryDataValue value, SnDataContext dataContext) { return(BlobStorageBase.UpdateBinaryPropertyAsync(value, dataContext)); }
public new static void InsertBinaryProperty(BinaryDataValue value, int versionId, int propertyTypeId, bool isNewNode) { BlobStorageBase.InsertBinaryProperty(value, versionId, propertyTypeId, isNewNode); }