Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

IBufferManager interface documentation conflicts with MultiBufferMemoryStream expectations #654

@olanat

Description

@olanat

In MultiBufferMemoryStream ctor, the IBufferManager.GetDefaultBufferSize() method is called and the result is stored in the bufferSize field of the stream. In MultiBufferMemoryStream .AddBlock it's asserted that a buffer returned from the bufferManager has this exact same size (bufferSize).

In the documentation of IBufferManager.TakeBuffer it's indicated that the returned buffer can of be the requested size or larger. This is also the behavior that (IMHO) is the easiest to achieve in a buffer manager implementation (for instance using System.Buffers).

I would suggest changing the code to allow larger buffers from TakeBuffer. And improve the documentation of the IBufferManager class. Right now the documentation in GetDefaultBufferSize and TakeBuffer is conflicting wrt the expected output buffer sizes.

Files:

  • azure-storage-net/Lib/Common/IBufferManager.cs
  • azure-storage-net/Lib/Common/Core/MultiBufferMemoryStream.cs

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions