Flow PHP

Part

Read onlyYes
FinalYes

One naming rule for the serial writer (part 0) and the parallel commit.

Constants

PLACEHOLDER  : string = '{part}'
RUN_LENGTH  : int = 16
The length of a serial run id (8 random bytes, hex): what an appended sibling of a plain file carries.

Properties

$append  : bool
$index  : int
$run  : string
$splits  : int

Methods

__construct()  : mixed
beside()  : Path
$file under Append when it exists already: <name>-<run>.<ext> beside it.
fill()  : Path
$destination with {part} replaced by name(); unchanged without the placeholder.
fromArray()  : self
glob()  : Path
{part} and every partition placeholder as *, plus **\/ before the basename when $partitioned: what an existing part of $destination matches.
in()  : bool
name()  : string
The index zero-padded to max(5, digits of the last split), then "-<run>" under Append: 00003, 00003-1a2b3c4d5e6f7a8b.
normalize()  : array{index: int<0, max>, splits: int<1, max>, run: non-empty-string, append: bool}
refuseReserved()  : void
serialRun()  : non-empty-string
stale()  : array<int, Path>
The globs of the existing files that $file, written for $destination, replaces under Overwrite: every part in $file's directory for a {part} destination (the whole destination when it is not partitioned), $file itself and its appended siblings (<name>-<run>.<ext>) otherwise - never a file Flow did not name.

Constants

PLACEHOLDER

public string PLACEHOLDER = '{part}'

RUN_LENGTH

The length of a serial run id (8 random bytes, hex): what an appended sibling of a plain file carries.

public int RUN_LENGTH = 16

Properties

$append

public bool $append

$index

public int $index

$splits

public int $splits

Methods

__construct()

public __construct(int<0, max> $index, int<1, max> $splits, non-empty-string $run, bool $append) : mixed
Parameters
$index : int<0, max>
$splits : int<1, max>
$run : non-empty-string
$append : bool

beside()

$file under Append when it exists already: <name>-<run>.<ext> beside it.

public beside(Path $file) : Path
Parameters
$file : Path
Return values
Path

fill()

$destination with {part} replaced by name(); unchanged without the placeholder.

public fill(Path $destination) : Path
Parameters
$destination : Path
Tags
throws
InvalidArgumentException

when {part} is outside the basename

Return values
Path

fromArray()

public static fromArray(array<string|int, mixed> $data) : self
Parameters
$data : array<string|int, mixed>

the shape of normalize()

Return values
self

glob()

{part} and every partition placeholder as *, plus **\/ before the basename when $partitioned: what an existing part of $destination matches.

public static glob(Path $destination, bool $partitioned) : Path
Parameters
$destination : Path
$partitioned : bool
Return values
Path

in()

public static in(Path $destination) : bool
Parameters
$destination : Path
Return values
bool

name()

The index zero-padded to max(5, digits of the last split), then "-<run>" under Append: 00003, 00003-1a2b3c4d5e6f7a8b.

public name() : string
Return values
string

normalize()

public normalize() : array{index: int<0, max>, splits: int<1, max>, run: non-empty-string, append: bool}
Return values
array{index: int<0, max>, splits: int<1, max>, run: non-empty-string, append: bool}

serialRun()

public static serialRun() : non-empty-string
Return values
non-empty-string —

a fresh run id for a serial write

stale()

The globs of the existing files that $file, written for $destination, replaces under Overwrite: every part in $file's directory for a {part} destination (the whole destination when it is not partitioned), $file itself and its appended siblings (<name>-<run>.<ext>) otherwise - never a file Flow did not name.

public static stale(Path $file, Path $destination) : array<int, Path>
Parameters
$file : Path
$destination : Path
Return values
array<int, Path>
On this page

Search results