Flow PHP

Blocks

FinalYes

Blocks is a collection of blocks that are filled with data.

Each file can be created from a single block or multiple blocks. Blocks are mostly used by remote filesystems as a performance optimization technique. Filesystem is appending into the blocks, whenever Block is full BlockLifecycle::filled(Block $block) is triggered which allows to upload the block to the remote filesystem.

Blocks are created by BlockFactory and filled with data by the Blocks collection. in most cases BlockFactory implementation is just creating blocks in a local filesystem tmp directory.

Methods

__construct()  : mixed
all()  : array<string|int, mixed>
append()  : void
block()  : Block
count()  : int
done()  : void
fromResource()  : void
size()  : int

Methods

__construct()

public __construct(int $blockSize[, BlockFactory $blockFactory = new NativeLocalFileBlocksFactory() ][, BlockLifecycle $blockLifecycle = new BlockVoidLifecycle() ]) : mixed
Parameters
$blockSize : int

block size in bytes

$blockFactory : BlockFactory = new NativeLocalFileBlocksFactory()
$blockLifecycle : BlockLifecycle = new BlockVoidLifecycle()

all()

public all() : array<string|int, mixed>
Return values
array<string|int, mixed>

append()

public append(string $data) : void
Parameters
$data : string

block()

public block() : Block
Return values
Block
  • current block that might not be filled yet

count()

public count() : int
Return values
int

fromResource()

public fromResource(resource $resource) : void
Parameters
$resource : resource

size()

public size() : int
Return values
int

        
On this page

Search results