class NodePopulator

Defined at line 26 of file ../../src/storage/blobfs/iterator/node_populator.h

A helper class which utilizes the visitor pattern to chain together a group of extents and nodes.

Precondition:

nodes.size() >= NodeCountForExtents(extents.size())

Public Methods

void NodePopulator (BaseAllocator * allocator, std::vector<ReservedExtent> extents, std::vector<ReservedNode> nodes)

Defined at line 23 of file ../../src/storage/blobfs/iterator/node_populator.cc

uint64_t NodeCountForExtents (uint64_t extent_count)

Returns the maximum number of nodes necessary to hold |extent_count| extents.

Defined at line 30 of file ../../src/storage/blobfs/iterator/node_populator.cc

void NodePopulator (const NodePopulator & )

Defined at line 31 of file ../../src/storage/blobfs/iterator/node_populator.h

void NodePopulator (NodePopulator && )

Defined at line 31 of file ../../src/storage/blobfs/iterator/node_populator.h

NodePopulator & operator= (const NodePopulator & )

Defined at line 31 of file ../../src/storage/blobfs/iterator/node_populator.h

NodePopulator & operator= (NodePopulator && )

Defined at line 31 of file ../../src/storage/blobfs/iterator/node_populator.h

zx_status_t Walk (OnNodeCallback on_node, OnExtentCallback on_extent)

Utilizes the |allocator| to locate all nodes provided by |nodes|, and allocate each node the

appropriate |extent|.

Along the way, this methods sets the following fields on the blob inode: |next_node|,

|extents|, |extent_count|. This method sets all fields on the container nodes.

Before each extent is accessed, |on_extent| is invoked. This allows a caller to modify how

much of the extent is actually used. If IterationCommand::Stop is returned from |on_extent|,

then extent-filling exits early, and no additional extents are used. This ability to "stop

short" when using extents is useful when less storage is needed to persist a blob than

originally allocated. This is common when using compression.

After all extents are accessed, |on_node| is invoked on all nodes which are actually used to

represent the blob. This may be smaller than the number of nodes passed in the ReservedNode

vector.

Defined at line 36 of file ../../src/storage/blobfs/iterator/node_populator.cc

Enumerations

enum IterationCommand
Name Value
Continue 0
Stop 1

Defined at line 36 of file ../../src/storage/blobfs/iterator/node_populator.h