class LazyBuffer

Defined at line 17 of file ../../src/storage/minfs/lazy_buffer.h

A lazy buffer wraps a buffer with a lazy reader so that blocks in the buffer can be lazily

read.

Public Methods

zx::result<std::unique_ptr<LazyBuffer>> Create (Bcache * bcache, const char * name, uint32_t block_size)

Create an instance of LazyBuffer.

Defined at line 9 of file ../../src/storage/minfs/lazy_buffer.cc

void Shrink (size_t block_count)

Shrink the buffer. Does nothing if buffer is smaller.

Defined at line 18 of file ../../src/storage/minfs/lazy_buffer.cc

void LazyBuffer (const LazyBuffer & )

Defined at line 34 of file ../../src/storage/minfs/lazy_buffer.h

LazyBuffer & operator= (const LazyBuffer & )

Defined at line 35 of file ../../src/storage/minfs/lazy_buffer.h

size_t size ()

Returns the size of the buffer in bytes.

Defined at line 38 of file ../../src/storage/minfs/lazy_buffer.h

ResizeableBufferType & buffer ()

Defined at line 40 of file ../../src/storage/minfs/lazy_buffer.h

zx::result<> Flush (PendingWork * transaction, MapperInterface * mapper, BaseBufferView * view, const Writer & writer)

Iterates through all the blocks in the view, maps from file offset to device offset using

|mapper| and then calls |writer| to actually write the data to the backing store.

Defined at line 40 of file ../../src/storage/minfs/lazy_buffer.cc

zx::result<> Flush (PendingWork * transaction, MapperInterface * mapper, BaseBufferView * view, const Writer & writer)

Iterates through all the blocks in the view, maps from file offset to device offset using

|mapper| and then calls |writer| to actually write the data to the backing store.

Defined at line 40 of file ../../src/storage/minfs/lazy_buffer.cc

zx::result<> Detach (Bcache * bcache)

Users must call Detach before destruction.

Defined at line 43 of file ../../src/storage/minfs/lazy_buffer.h

zx::result<> Grow (size_t block_count)

Defined at line 45 of file ../../src/storage/minfs/lazy_buffer.h

template <typename T>
zx::result<BufferView<T>> GetView (size_t index, size_t count, Reader * reader, BaseBufferView::Flusher flusher)

Returns a read/write view for the given range. |flusher| will be called by the view if

modified. Implementations should call the Flush method above to flush the buffer, which

will do the mappings for you. For example:

BufferView

<uint64

_t> view;

status = buffer->GetView(

offset, count,

&reader

,

[buffer, transaction](BaseBufferView* view) {

Mapper mapper;

return buffer->Flush(transaction,

&mapper

, view, writer);

},

&view

);

Defined at line 68 of file ../../src/storage/minfs/lazy_buffer.h

template <typename T>
zx::result<BufferView<T>> GetView (size_t index, size_t count, Reader * reader)

Returns a read only view for the given range.

Defined at line 80 of file ../../src/storage/minfs/lazy_buffer.h

Records