Ferreteria/v0.6/sys/buffer
< Ferreteria | v0.6 | sys
Jump to navigation
Jump to search
|
Ferreteria: Data Buffering System
|
About
- Purpose: for holding data temporarily while it is in transit between two places that need to process it in different-sized chunks
Status
- 2025-12-17 I suspect this system needs reworking -- it should start with the idea of a sourceless buffer (you can read or write to it), and then automatic refilling or dumping gets added on later along with information about the combined system.
Functions
| function | defined/required in | implemented in |
|---|---|---|
AvailBuffByteCount()
|
IO\Aspect\Connx\Buffer
| |
AvailSrceByteCount()
|
IO\Aspect\Connx\Buffer: code prompt
|
IO\Aspect\Connx\Buffer\File\Reader, IO\Aspect\Connx\Buffer\File\Writer
|
SpentByteCount()
|
IO\Aspect\Connx\Buffer
|
IO\Aspect\Connx\Buffer
|
Notes
2025-12-16
I had to document all this stuff in order to figure out why RenderStatus() isn't showing progress when other indicators are. Current code:
#
public function RenderStatus() : string {
$nTot = $this->SpentByteCount();
$sTot = $this->Formatter()->format($nTot);
$nFil = $this->DataFile()->Size();
$ftRem = ''; // default
if (is_int($nFil) && ($nFil > 0)) {
$nRem = $nFil - $nTot;
if ($nRem > 0) {
$sRem = $this->Formatter()->format($nRem);
$ftRem = "($nFil-$nTot=) $sRem | ";
}
}
$nMem = memory_get_usage();
$sMem = $this->Formatter()->format($nMem);
$sTime = $this->DurationString();
$sNotes = $this->GetNotes();
$ftNotes = is_string($sNotes) ? (' : '.$sNotes) : '';
return "($sTime) $sTot bytes ({$ftRem}mem: $sMem)$ftNotes";
}
...so basically:
- This is basing all of its calculations on
SpentByteCount()- ...which is coming solely from
QNSpent()
- ...which is coming solely from
- Meanwhile,
RemoveLine():- calls
RefillBuffer()- which is looking at
AvailBuffByteCount()andAvailSrceByteCount(), and settingAddBytesForFetch()AvailBuffByteCount()is just the length of$this->sBuffAvailSrceByteCount(), in a file-reading context, is the size of the source-fileAddBytesForFetch()just adds bytes to$this->sBuff
- which is looking at
- sets
PullBytes()(fkaDiscardBytes()) restores bytes to$this->sBuffand increments$this->nSpentwhen it should be incrementing viaQNSpent().
- calls