Ferreteria/v0.6/sys/buffer

From Woozle Writes Code
< Ferreteria‎ | v0.6‎ | sys(Redirected from Ferreteria/v0.6/sys/Buffer)
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: