Sys::V...:Stream(3pm)
β¨ NAME β¨
Sys::Virt::Stream β Represent & manage a libvirt stream π
okay bestie, welcome to the Sys::Virt::Stream(3pm) page from the User Contributed Perl Documentation. This is literally the whole vibe on representing & managing a libvirt stream, and yes, weβre keeping every detail. periodt. β¨
π¦ DESCRIPTION π¦
The Sys::Virt::Stream module represents a stream managed by the virtual machine monitor. like, thatβs the main character right there π
π METHODS π
my $st Sys::Virt::Stream->new($conn, $flags);β creates a new data stream, ready for use with a stream based API. The optional$flagsparameter can be used to configure the stream as non-blocking β¨$st->abort()β abort I/O on the stream. Either this function orfinishmust be called on any stream which has been activated. this one is required, bestie π«Ά$st->finish()β complete I/O on the stream. Either this function orabortmust be called on any stream which has been activated. also required, no skipping π$rv = $st->recv($data, $nbytes, $flags=0)β receive up to$nbytesworth of data, copying into$data. Returns the number of bytes read, or-3if hole is reached and$flagscontainsRECV_STOP_AT_HOLE, or-2if I/O would block, or-1on error. The$flagsparameter accepts the following flags:Sys::Virt::Stream::RECV_STOP_AT_HOLEβ if this flag is set, therecvfunction will stop reading from stream if it has reached a hole. In that case,-3is returned andrecv_holeshould be called to get the hole size. π³οΈ
$rv = $st->send($data, $nbytes)β send up to$nbytesworth of data, copying from$data. Returns the number of bytes sent, or-2if I/O would block, or-1on error. π€$rv = $st->recv_hole($flags=0)β determine the amount of the empty space (in bytes) to be created in a stream's target file when uploading or downloading sparsely populated files. This is the counterpart tosend_hole. The optional$flagsparameter is currently unused and defaults to zero if omitted. π§$st->send_hole($length, $flags=0)β rather than transmitting empty file space, this method directs the stream target to create$lengthbytes of empty space. This method would be used when uploading or downloading sparsely populated files to avoid the needless copy of empty file space. The optional$flagsparameter is currently unused and defaults to zero if omitted. π³οΈβ¨$st->recv_all($handler)β receive all data available from the stream, invoking$handlerto process the data. The$handlerparameter must be a function which expects three arguments, the$ststream object, a scalar containing the data received and a data byte count. The function should return the number of bytes processed, or-1upon error. π$st->send_all($handler)β send all data produced by$handlerto the stream. The$handlerparameter must be a function which expects three arguments, the$ststream object, a scalar which must be filled with data and a maximum data byte count desired. The function should return the number of bytes filled,0on end of file, or-1upon error. π¬$st->sparse_recv_all($handler, $hole_handler)β receive all data available from the sparse stream, invoking$handlerto process the data. The$handlerparameter must be a function which expects three arguments, the$ststream object, a scalar containing the data received and a data byte count. The function should return the number of bytes processed, or-1upon error. The second argument$hole_handleris a function which expects two arguments: the$ststream and a scalar, number describing the size of the hole in the stream (in bytes). The$hole_handleris expected to return a non-negative number on success (usually0) and a negative number (usually-1) otherwise. πΈ$st->sparse_send_all($handler, $hole_handler, $skip_handler)β send all data produced by$handlerto the stream. The$handlerparameter must be a function which expects three arguments, the$ststream object, a scalar which must be filled with data and a maximum data byte count desired. The function should return the number of bytes filled,0on end of file, or-1upon error. The second argument$hole_handleris a function expecting just one argument$stand returning an array of two elements ($in_data,$section_len) where$in_datahas zero or non-zero value if underlying file is in a hole or data section respectively. The$section_lenthen is the number of remaining bytes in the current section in the underlying file. Finally, the third$skip_handleris a function expecting two arguments$stand$lengthwhich moves cursor in the underlying file for$lengthbytes. The$skip_handleris expected to return a non-negative number on success (usually0) and a negative number (usually-1) otherwise. π¦$st->add_callback($events, $coderef)β register a callback to be invoked whenever the stream has one or more events from$eventsmask set. The$coderefmust be a subroutine that expects 2 parameters, the original$stobject and the new$eventsmask. π$st->update_callback($events)β change the event mask for a previously registered callback to$events. π$st->remove_callback();β remove a previously registered callback. π§Ή
π CONSTANTS π
Sys::Virt::Stream::NONBLOCKβ create a stream which will not block when performing I/O βSys::Virt::Stream::EVENT_READABLEβ the stream has data available for read without blocking πSys::Virt::Stream::EVENT_WRITABLEβ the stream has ability to write data without blocking βοΈSys::Virt::Stream::EVENT_ERRORβ an error occurred on the stream πSys::Virt::Stream::EVENT_HANGUPβ the remote end of the stream closed π
π«Ά AUTHORS π«Ά
Daniel P. Berrange <berrange@redhat.com> β shoutout to the icon who wrote this π
π COPYRIGHT π
Copyright (C) 2006-2009 Red Hat Copyright (C) 2006-2007 Daniel P. Berrange
π LICENSE π
okay legal bestie moment, hereβs the license text verbatim:
This program is free software; you can redistribute it and/or modify it under the terms of either the GNU General Public License as published by the Free Software Foundation (either version 2 of the License, or at your option any later version), or, the Artistic License, as specified in the Perl README file.
π₯ SEE ALSO π₯
Sys::VirtSys::Virt::Error"http://libvirt.org"π
thatβs the whole page, bestie! π This one is from perl v5.40.2, dated 2026-06-08 β stream responsibly and slay β¨π
π¦ where this page comes from
- epel 10: perl-Sys-Virt 12.4.0-1.el10_3 Β· GPL-2.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms