Part
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
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
$run
public
string
$run
$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
Pathfill()
$destination with {part} replaced by name(); unchanged without the placeholder.
public
fill(Path $destination) : Path
Parameters
- $destination : Path
Tags
Return values
PathfromArray()
public
static fromArray(array<string|int, mixed> $data) : self
Parameters
- $data : array<string|int, mixed>
-
the shape of normalize()
Return values
selfglob()
{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
Pathin()
public
static in(Path $destination) : bool
Parameters
- $destination : Path
Return values
boolname()
The index zero-padded to max(5, digits of the last split), then "-<run>" under Append: 00003, 00003-1a2b3c4d5e6f7a8b.
public
name() : string
Return values
stringnormalize()
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}refuseReserved()
public
static refuseReserved(Path $destination, Partitioning $partitioning) : void
Parameters
- $destination : Path
- $partitioning : Partitioning
Tags
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