view release on metacpan or search on metacpan
lib/Corona/Server.pm view on Meta::CPAN
'psgi.url_scheme' => 'http', # SSL support?
'psgi.nonblocking' => Plack::Util::TRUE,
'psgi.run_once' => Plack::Util::FALSE,
'psgi.multithread' => Plack::Util::TRUE,
'psgi.multiprocess' => Plack::Util::FALSE,
'psgi.streaming' => Plack::Util::TRUE,
'psgix.io' => $fh->fh,
};
my $res = [ 400, [ 'Content-Type' => 'text/plain' ], [ 'Bad Request' ] ];
lib/Corona/Server.pm view on Meta::CPAN
push @lines, "\015\012";
$fh->syswrite(join '', @lines);
if (!defined $res->[2]) {
# streaming write
return Plack::Util::inline_object
write => sub { $fh->syswrite(join '', @_) },
close => $rouse_cb;
} elsif (HAS_AIO && Plack::Util::is_real_fh($res->[2])) {
my $length = -s $res->[2];
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Courriel.pm view on Meta::CPAN
This method will send the stringified email to the specified output. The output
can be a subroutine reference, a filehandle, or an object with a C<print()>
method. The output may be sent as a single string, as a list of strings, or via
multiple calls to the output.
For large emails, streaming can be much more memory efficient than generating a
single string in memory.
=head2 $email->as_string()
Returns the email as a string, along with its headers. Lines will be terminated
view all matches for this distribution
view release on metacpan or search on metacpan
t/19_incr.t view on Meta::CPAN
my $r = $coder->incr_parse("}");
ok (defined $r, "sqstr-incr: object completes after closing brace");
is_deeply ($r, {a => "}"}, "sqstr-incr: decoded value correct");
}
# allow_singlequote: chunked streaming with structural chars inside single-quoted string
{
my $coder = Cpanel::JSON::XS->new->allow_singlequote(1);
# feed one byte at a time to exercise every state transition
my $json = "{'x':'}[{'}";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/Bear/HMAC.pm view on Meta::CPAN
}
say unpack 'H*', $digester->out;
=head1 DESCRIPTION
This represents a streaming implementation of hmac on top of common hash functions.
=head1 METHODS
=head2 new($key)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/HSM/Stream.pm view on Meta::CPAN
}
$ciphertext .= $stream->finish;
=head1 DESCRIPTION
This is a base-class for streaming actions.
=head1 METHODS
=head2 get_state()
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/NaCl/Sodium/auth.pod view on Meta::CPAN
Method returns true if message has been verified, false otherwise.
=head1 ADVANCED USAGE
Single pass and streaming API keyed message authentication using I<HMAC-SHA-256>,
I<HMAC-SHA-512> and I<HMAC-SHA-512/256> are described below.
=head2 HMAC-SHA-256
=head3 hmacsha256_keygen
view all matches for this distribution
view release on metacpan or search on metacpan
- Use dead-store-proof memset loop for zeroing sensitive memory so the
compiler cannot optimise away the wipe. PR #50
- Define PERL_NO_GET_CONTEXT in the XS file for correctness under
threaded Perl builds. PR #60
- Silence -Wall -Wextra compiler warnings in XS code. PR #49
- Include t/03streaming.t in MANIFEST so it is shipped in CPAN
distributions. PR #48
Improvements:
- Inherit from Digest::base to support the standard Perl Digest API:
b64digest, add_bits, and loading via Digest->new('RIPEMD-160'). PR #58
Maintenance:
- Add proper =head2 method sections to MAC.pm POD. PR #51
- Add comprehensive MAC test suite covering HMAC correctness, reset,
addfile, and long-key hashing. PR #55
- Add streaming consistency tests verifying that single-call and
multi-call add() produce identical digests. PR #46
- Move X[] scratch buffer from the RIPEMD-160 state struct to the
stack, reducing per-context memory usage. PR #52
- Add #!include_default to MANIFEST.SKIP for robust exclusion of
build artefacts. PR #59
view all matches for this distribution
view release on metacpan or search on metacpan
Revision history for Perl module Crypt::Rijndael
1.16 - 2021-04-01
* Add non-blocksized encoding support to streaming modes
* Explicitly use downgraded strings
1.15 - 2020-10-10
* Use standard uint8_t and uint32_t from stdint.h
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/XkcdPassword/Words/EN/Roget.pm view on Meta::CPAN
stray
streak
streaked
stream
streamer
streaming
streamlet
streamy
street
streets
streetwalker
view all matches for this distribution
view release on metacpan or search on metacpan
ext/xxHash/CHANGELOG view on Meta::CPAN
- doc : XXH3 specification (@Adrien1018)
- doc : improved doxygen documentation (@easyaspi314, @t-mat)
- misc : dedicated sanity test binary (@t-mat)
v0.8.1
- perf : much improved performance for XXH3 streaming variants, notably on gcc and msvc
- perf : improved XXH64 speed and latency on small inputs
- perf : small XXH32 speed and latency improvement on small inputs of random size
- perf : minor stack usage improvement for XXH32 and XXH64
- api : new experimental variants XXH3_*_withSecretandSeed()
- api : update XXH3_generateSecret(), can no generate secret of any size (>= XXH3_SECRET_SIZE_MIN)
ext/xxHash/CHANGELOG view on Meta::CPAN
- perf: automatic vector detection and selection at runtime (`xxh_x86dispatch.h`), initiated by @easyaspi314
- perf: added AVX512 support, by @gzm55
- api : new: secret generator `XXH_generateSecret()`, suggested by @koraa
- api : fix: XXH3_state_t is movable, identified by @koraa
- api : fix: state is correctly aligned in AVX mode (unlike `malloc()`), by @easyaspi314
- api : fix: streaming generated wrong values in some combination of random ingestion lengths, reported by @WayneD
- cli : fix unicode print on Windows, by @easyaspi314
- cli : can `-c` check file generated by sfv
- build: `make DISPATCH=1` generates `xxhsum` and `libxxhash` with runtime vector detection (x86/x64 only)
- install: cygwin installation support
- doc : Cryptol specification of XXH32 and XXH64, by @weaversa
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Crypt/Mode/CFB.pm view on Meta::CPAN
# in decrypt mode
my $plaintext = $m->add($ciphertext);
=head2 finish
CFB is a streaming mode and does not use padding, so C<finish> returns an empty
string. It exists for API consistency with L<Crypt::Mode::CBC> and
L<Crypt::Mode::ECB> and may be safely called or omitted.
$m->start_encrypt($key, $iv);
my $ciphertext = '';
view all matches for this distribution
view release on metacpan or search on metacpan
0.41 - 2013-07-29, H.Merijn Brand
* Use File::Spec->tmpdir () for universal existing folder
Note that huge $TMP folders may cause the test to run slow
* Use File::Spec::rel2abs () instead of abs_path and hoops
* Guard against parallel testing, which is unsupported
* Guard against streaming tests (they PASS on the DBI-devel)
0.40 - 2013-07-23, H.Merijn Brand
* Fix version references in doc
* Fix tests for Windows
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/DuckDB/FFI.pm view on Meta::CPAN
duckdb_result_error_type => [['duckdb_result*'] => 'duckdb_error_type'],
# Result Functions
duckdb_result_get_chunk => [['duckdb_result', 'idx_t'] => 'duckdb_data_chunk'],
duckdb_result_is_streaming => [['duckdb_result'] => 'bool'],
duckdb_result_chunk_count => [['duckdb_result'] => 'idx_t'],
duckdb_result_return_type => [['duckdb_result'] => 'duckdb_result_type'],
# Safe Fetch Functions
lib/DBD/DuckDB/FFI.pm view on Meta::CPAN
duckdb_bind_null => [['duckdb_prepared_statement', 'idx_t'] => 'duckdb_state'],
# Execute Prepared Statements
duckdb_execute_prepared => [['duckdb_prepared_statement', 'duckdb_result*'] => 'duckdb_state'],
duckdb_execute_prepared_streaming => [['duckdb_prepared_statement', 'duckdb_result*'] => 'duckdb_state'],
# Extract Statements
duckdb_extract_statements => [['duckdb_connection', 'string', 'duckdb_extracted_statements*'] => 'idx_t'],
duckdb_prepare_extracted_statement => [['duckdb_connection', 'duckdb_extracted_statements', 'idx_t', 'duckdb_prepared_statement*'] => 'duckdb_state'],
lib/DBD/DuckDB/FFI.pm view on Meta::CPAN
duckdb_destroy_extracted => [['duckdb_extracted_statements*'] => 'void'],
# Pending Result Interface
duckdb_pending_prepared => [['duckdb_prepared_statement', 'duckdb_pending_result*'] => 'duckdb_state'],
duckdb_pending_prepared_streaming => [['duckdb_prepared_statement', 'duckdb_pending_result*'] => 'duckdb_state'],
duckdb_destroy_pending => [['duckdb_pending_result*'] => 'void'],
duckdb_pending_error => [['duckdb_pending_result'] => 'string'],
duckdb_pending_execute_task => [['duckdb_pending_result'] => 'duckdb_pending_state'],
duckdb_pending_execute_check_state => [['duckdb_pending_result'] => 'duckdb_pending_state'],
duckdb_execute_pending => [['duckdb_pending_result', 'duckdb_result*'] => 'duckdb_state'],
lib/DBD/DuckDB/FFI.pm view on Meta::CPAN
=over
=item * duckdb_result_get_chunk
=item * duckdb_result_is_streaming
=item * duckdb_result_chunk_count
=item * duckdb_result_return_type
lib/DBD/DuckDB/FFI.pm view on Meta::CPAN
=over
=item * duckdb_execute_prepared
=item * duckdb_execute_prepared_streaming
=back
=head2 Extract Statements
lib/DBD/DuckDB/FFI.pm view on Meta::CPAN
=over
=item * duckdb_pending_prepared
=item * duckdb_pending_prepared_streaming
=item * duckdb_destroy_pending
=item * duckdb_pending_error
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/JDBC.pod view on Meta::CPAN
DBI metadata methods, cancel, row cache.
=item *
Better handling of long fields via some sort of streaming interface.
=item *
JDBC 2.0 support.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/Oracle.pm view on Meta::CPAN
contain, starting at position 100234 in the bin_data column,
the string "This string will overwrite a portion of the blob".
=head3 Example: Streaming character data from the database
In this example, we demonstrate a technique for streaming
data from the database to a file handle, in this case
STDOUT. This allows more data to be read in and written out
than could be stored in memory at a given time.
my $lob_id = 17; # Arbitrary row identifier, for example
view all matches for this distribution
view release on metacpan or search on metacpan
t/03-failover.t view on Meta::CPAN
for my $i ( 1 .. $max_attempts ) {
my $info = get_cluster_info();
next unless $info;
# Count nodes that are running or streaming (replicas in sync)
my @ready =
grep { $_->{state} eq 'running' || $_->{state} eq 'streaming' }
@{ $info->{members} };
if ( @ready >= 3 ) {
diag("All 3 nodes are ready");
return 1;
t/03-failover.t view on Meta::CPAN
my @replicas = @{ $info->{replicas} };
skip "Need at least one replica for cached failover test", 4
unless @replicas;
# Find a replica that is ready (running or streaming)
my ($ready_replica) =
grep { $_->{state} eq 'running' || $_->{state} eq 'streaming' } @replicas;
skip "No ready replica for failover", 4 unless $ready_replica;
my $new_leader = $ready_replica->{name};
diag("Triggering failover to: $new_leader");
t/03-failover.t view on Meta::CPAN
my $info = get_cluster_info();
ok( $info, 'Cluster is accessible' );
ok( $info->{leader}, 'Cluster has a leader' );
# Count running or streaming nodes
my $ready = grep { $_->{state} eq 'running' || $_->{state} eq 'streaming' }
@{ $info->{members} };
diag("Final cluster state:");
diag( " Leader: " . $info->{leader}{host} );
diag(" Ready members: $ready");
view all matches for this distribution
view release on metacpan or search on metacpan
- Aliases for perl_call_*
- Updated to sqlite 2.8.6
- use sqlite_freemem everywhere
0.27
- Changed API to use sqlite streaming API. This makes things slightly
slower for large result sets, at the benefit of being more "sane"
internally.
0.26
- Update to sqlite 2.8.5
view all matches for this distribution
view release on metacpan or search on metacpan
** this function, all changes that relate to a single table are visited
** consecutively. There is no chance that the iterator will visit a change
** the applies to table X, then one for table Y, and then later on visit
** another change for table X.
**
** The behavior of sqlite3changeset_start_v2() and its streaming equivalent
** may be modified by passing a combination of
** [SQLITE_CHANGESETSTART_INVERT | supported flags] as the 4th parameter.
**
** Note that the sqlite3changeset_start_v2() API is still <b>experimental</b>
** and therefore subject to change.
**
** Any number of calls to add() and output() may be made between the calls to
** new() and delete(), and in any order.
**
** As well as the regular sqlite3changegroup_add() and
** sqlite3changegroup_output() functions, also available are the streaming
** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm().
*/
SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
/*
** caller to eventually free any such buffer using sqlite3_free(). The buffer
** is only allocated and populated if one or more conflicts were encountered
** while applying the patchset. See comments surrounding the sqlite3_rebaser
** APIs for further details.
**
** The behavior of sqlite3changeset_apply_v2() and its streaming equivalent
** may be modified by passing a combination of
** [SQLITE_CHANGESETAPPLY_NOSAVEPOINT | supported flags] as the 9th parameter.
**
** Note that the sqlite3changeset_apply_v2() API is still <b>experimental</b>
** and therefore subject to change.
SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p);
/*
** CAPI3REF: Streaming Versions of API functions.
**
** The six streaming API xxx_strm() functions serve similar purposes to the
** corresponding non-streaming API functions:
**
** <table border=1 style="margin-left:8ex;margin-right:8ex">
** <tr><th>Streaming function<th>Non-streaming equivalent</th>
** <tr><td>sqlite3changeset_apply_strm<td>[sqlite3changeset_apply]
** <tr><td>sqlite3changeset_apply_strm_v2<td>[sqlite3changeset_apply_v2]
** <tr><td>sqlite3changeset_concat_strm<td>[sqlite3changeset_concat]
** <tr><td>sqlite3changeset_invert_strm<td>[sqlite3changeset_invert]
** <tr><td>sqlite3changeset_start_strm<td>[sqlite3changeset_start]
** <tr><td>sqlite3session_changeset_strm<td>[sqlite3session_changeset]
** <tr><td>sqlite3session_patchset_strm<td>[sqlite3session_patchset]
** </table>
**
** Non-streaming functions that accept changesets (or patchsets) as input
** require that the entire changeset be stored in a single buffer in memory.
** Similarly, those that return a changeset or patchset do so by returning
** a pointer to a single large buffer allocated using sqlite3_malloc().
** Normally this is convenient. However, if an application running in a
** low-memory environment is required to handle very large changesets, the
** large contiguous memory allocations required can become onerous.
**
** In order to avoid this problem, instead of a single large buffer, input
** is passed to a streaming API functions by way of a callback function that
** the sessions module invokes to incrementally request input data as it is
** required. In all cases, a pair of API function parameters such as
**
** <pre>
** int nChangeset,
** error occurs the xInput method should copy up to (*pnData) bytes of data
** into the buffer and set (*pnData) to the actual number of bytes copied
** before returning SQLITE_OK. If the input is completely exhausted, (*pnData)
** should be set to zero to indicate this. Or, if an error occurs, an SQLite
** error code should be returned. In all cases, if an xInput callback returns
** an error, all processing is abandoned and the streaming API function
** returns a copy of the error code to the caller.
**
** In the case of sqlite3changeset_start_strm(), the xInput callback may be
** invoked by the sessions module at any point during the lifetime of the
** iterator. If such an xInput callback returns an error, the iterator enters
** an error state, whereby all subsequent calls to iterator functions
** immediately fail with the same error code as returned by xInput.
**
** Similarly, streaming API functions that return changesets (or patchsets)
** return them in chunks by way of a callback function instead of via a
** pointer to a single large buffer. In this case, a pair of parameters such
** as:
**
** <pre>
** pOut pointer supplied by the application. The second parameter, pData,
** points to a buffer nData bytes in size containing the chunk of output
** data being returned. If the xOutput callback successfully processes the
** supplied data, it should return SQLITE_OK to indicate success. Otherwise,
** it should return some other SQLite error code. In this case processing
** is immediately abandoned and the streaming API function returns a copy
** of the xOutput error code to the application.
**
** The sessions module never invokes an xOutput callback with the third
** parameter set to a value less than or equal to zero. Other than this,
** no guarantees are made as to the size of the chunks of data returned.
** the effect of calling this function depends on the value of the first
** parameter.
**
** <dl>
** <dt>SQLITE_SESSION_CONFIG_STRMSIZE<dd>
** By default, the sessions module streaming interfaces attempt to input
** and output data in approximately 1 KiB chunks. This operand may be used
** to set and query the value of this configuration setting. The pointer
** passed as the second argument must point to a value of type (int).
** If this value is greater than 0, it is used as the new streaming data
** chunk size for both input and output. Before returning, the (int) value
** pointed to by pArg is set to the final value of the streaming interface
** chunk size.
** </dl>
**
** This function returns SQLITE_OK if successful, or an SQLite error code
** otherwise.
typedef struct SessionChange SessionChange;
typedef struct SessionBuffer SessionBuffer;
typedef struct SessionInput SessionInput;
/*
** Minimum chunk size used by streaming versions of functions.
*/
#ifndef SESSIONS_STRM_CHUNK_SIZE
# ifdef SQLITE_TEST
# define SESSIONS_STRM_CHUNK_SIZE 64
# else
** change to contain a field set to "undefined".
**
** REBASE BLOB FORMAT:
**
** A rebase blob may be output by sqlite3changeset_apply_v2() and its
** streaming equivalent for use with the sqlite3_rebaser APIs to rebase
** existing changesets. A rebase blob contains one entry for each conflict
** resolved using either the OMIT or REPLACE strategies within the apply_v2()
** call.
**
** The format used for a rebase blob is very similar to that used for
int bInvert = !!(flags & SQLITE_CHANGESETSTART_INVERT);
return sessionChangesetStart(pp, xInput, pIn, 0, 0, bInvert);
}
/*
** If the SessionInput object passed as the only argument is a streaming
** object and the buffer is full, discard some data to free up space.
*/
static void sessionDiscardData(SessionInput *pIn){
if( pIn->xInput && pIn->iNext>=sessions_strm_chunk_size ){
int nMove = pIn->buf.nBuf - pIn->iNext;
/*
** Serialize a changeset (or patchset) based on all changesets (or patchsets)
** added to the changegroup object passed as the first argument.
**
** If xOutput is not NULL, then the changeset/patchset is returned to the
** user via one or more calls to xOutput, as with the other streaming
** interfaces.
**
** Or, if xOutput is NULL, then (*ppOut) is populated with a pointer to a
** buffer containing the output changeset before this function returns. In
** this case (*pnOut) is set to the size of the output buffer in bytes. It
view all matches for this distribution
view release on metacpan or search on metacpan
sqlite-amalgamation.c view on Meta::CPAN
** leaf layer of the tree.
*/
typedef struct LeavesReader {
int idx; /* Index within the segment. */
sqlite3_stmt *pStmt; /* Statement we're streaming leaves from. */
int eof; /* we've seen SQLITE_DONE from pStmt. */
LeafReader leafReader; /* reader for the current leaf. */
DataBuffer rootData; /* root data for inline. */
} LeavesReader;
view all matches for this distribution
view release on metacpan or search on metacpan
- Aliases for perl_call_*
- Updated to sqlite 2.8.6
- use sqlite_freemem everywhere
0.27
- Changed API to use sqlite streaming API. This makes things slightly
slower for large result sets, at the benefit of being more "sane"
internally.
0.26
- Update to sqlite 2.8.5
view all matches for this distribution
view release on metacpan or search on metacpan
- Aliases for perl_call_*
- Updated to sqlite 2.8.6
- use sqlite_freemem everywhere
0.27
- Changed API to use sqlite streaming API. This makes things slightly
slower for large result sets, at the benefit of being more "sane"
internally.
0.26
- Update to sqlite 2.8.5
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/Wire10.pm view on Meta::CPAN
}
sub take_imp_data {
my $dbh = shift;
# Finish any active statements (important if streaming enabled).
for my $sth (@{$dbh->{ChildHandles} || []}) {
next unless $sth;
$sth->finish if $sth->{Active};
}
lib/DBD/Wire10.pm view on Meta::CPAN
}
}
my $rowcount = eval {
$sth->finish;
my $stream_results = $sth->FETCH('wire10_streaming') || 0;
my $res = $stream_results ? $ps->stream : $ps->query;
die if $wire->get_error_info;
$sth->STORE('wire10_warning_count', $res->get_warning_count);
lib/DBD/Wire10.pm view on Meta::CPAN
}
sub finish {
my $sth = shift;
my $dbh = $sth->{Database};
# If in streaming mode, flush remaining results.
my $iterator = $sth->{wire10_iterator};
$iterator->spool if defined $iterator;
$sth->{wire10_iterator} = undef;
$sth->STORE('Active', 0);
$sth->SUPER::finish;
lib/DBD/Wire10.pm view on Meta::CPAN
Contains the auto_increment value for the last row inserted.
my $id = $sth->{wire10_insertid};
=head4 wire10_streaming
If this is set to 1 (or any value that evaluates to true), results will be streamed from the server rather than downloaded all at once, when the statement is executed.
$sth->{wire10_streaming} = 1;
Notice that the underlying protocol has a limitation: when a streaming statement is active, no other statements can execute on the same connection.
=head4 wire10_warning_count
Contains the number of warnings produced by the last query.
lib/DBD/Wire10.pm view on Meta::CPAN
=head3 Supported C<mysql_> attributes
All of the C<mysql_> attributes are unavailable. DBI requires that each driver uses a unique prefix, therefore this driver supports only attributes named C<wire10_>.
Not all C<mysql_> attributes have equivalently named C<wire10_> attributes. For example, there is no C<mysql_use_result> attribute, but one called C<wire10_streaming> does exactly the same.
=head2 Dependencies
This module requires these other modules and libraries:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBD/Gofer/Transport/stream.pm view on Meta::CPAN
__END__
=head1 NAME
DBD::Gofer::Transport::stream - DBD::Gofer transport for stdio streaming
=head1 SYNOPSIS
DBI->connect('dbi:Gofer:transport=stream;url=ssh:username@host.example.com;dsn=dbi:...',...)
view all matches for this distribution
view release on metacpan or search on metacpan
doc/rfc3920-notes.txt view on Meta::CPAN
Copyright (C) The Internet Society (2004).
Abstract
This memo defines the core features of the Extensible Messaging and
Presence Protocol (XMPP), a protocol for streaming Extensible Markup
Language (XML) elements in order to exchange structured information
in close to real time between any two network endpoints. While XMPP
provides a generalized, extensible framework for exchanging XML data,
it is used mainly for the purpose of building instant messaging and
presence applications that meet the requirements of RFC 2779.
doc/rfc3920-notes.txt view on Meta::CPAN
11. XML Usage within XMPP
11.1. Restrictions
XMPP is a simplified and specialized protocol for streaming XML
elements in order to exchange structured information in close to real
time. Because XMPP does not require the parsing of arbitrary and
complete XML documents, there is no requirement that XMPP needs to
support the full feature set of [XML]. In particular, the following
restrictions apply.
view all matches for this distribution
view release on metacpan or search on metacpan
av_push(av, newRV_noinc((SV *)h));
}
return newRV_noinc((SV *)av);
}
/* --- Direct DMS -> conformance JSON streaming emit -------------------------
*
* For workloads where the only consumer of the parse tree is a JSON-emit
* step (e.g. the conformance encoder, dms-tests harness), building the
* full Perl SV/HV/AV/Tie::IxHash tree just to walk it once is pure waste.
* `parse_to_json_bytes(src)` skips that round trip: it parses, then
view all matches for this distribution
view release on metacpan or search on metacpan
av_push(av, newRV_noinc((SV *)h));
}
return newRV_noinc((SV *)av);
}
/* --- Direct DMS -> conformance JSON streaming emit -------------------------
*
* For workloads where the only consumer of the parse tree is a JSON-emit
* step (e.g. the conformance encoder, dms-tests harness), building the
* full Perl SV/HV/AV/Tie::IxHash tree just to walk it once is pure waste.
* `parse_to_json_bytes(src)` skips that round trip: it parses, then
view all matches for this distribution
view release on metacpan or search on metacpan
* all type keys are inherited by default
* new dta-cab-analysis -analyzer-class=CLASS option
* new Chain::Multi analyzer option 'chain=C1,C2,...' parses user-defined sub-chains
v1.04 2010-09-22 09:38 moocow
* added -block-size=NLINES option to dta-cab-analyze.perl for pseudo-streaming TT analysis
* updated MorphSafe: first- and geonames are now 'safe'
v1.03 2010-05-19 10:36 moocow
* require Unicode::CharName
* updated system/resources using CAB v1.x on uhura (no complete re-build yet)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DTOne/Crypt.pm view on Meta::CPAN
Master key is expected to be exactly 256 bits in length, encoded in base64.
=head2 Performance
Random byte generation on Linux might run slow over time unless L<haveged(8)>
is running. In this scenario, the streaming facility of AES-GCM will be more
memory efficient.
=head1 AUTHOR
Arnold Tan Casis E<lt>atancasis@cpan.orgE<gt>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer/Plugin/StreamData.pm view on Meta::CPAN
chunk at a time. For example, the data could be fetched row by row from a
database server, with each row processed and then dispatched to the client via
the write() method.
The reason for this plugin is that the interface defined by PSGI for data
streaming is annoyingly complex and difficult to work with. By hiding the
complexity, this plugin makes it simple to set up an application which streams
long responses instead of marshalling them into a single response message.
This plugin can be used with any L<PSGI> compatible web server, and includes a
method by which you can check whether the server supports streaming.
=head1 USAGE
=cut
# Between the PSGI interface standard and the way Dancer does things,
# streaming a response involves a callback that returns a callback that is
# passed a callback, none of which are called with the necessary parameters.
# So the easiest way to get the necessary information to the routines that
# need it is to store this information in private variables. Not the most
# elegant solution, but it works. In fact, Dancer itself stores a lot of
# things in private variables.
lib/Dancer/Plugin/StreamData.pm view on Meta::CPAN
register 'stream_data' => sub {
my ($data, $call) = @_;
# First make sure that the server supports streaming
my $env = Dancer::SharedData->request->env;
unless ( $env->{'psgi.streaming'} ) {
croak 'Sorry, this server does not support PSGI streaming.';
}
# Store the parameters for later use by stream_callback()
$stream_object = $data;
lib/Dancer/Plugin/StreamData.pm view on Meta::CPAN
$stream_status = undef;
@stream_headers = ();
# Indicate to Dancer that the response will be streamed, and specify a
# callback to set up the streaming.
my $resp = Dancer::SharedData::response;
$resp->streamed(\&prepare_stream);
my $c = Dancer::Continuation::Route::FileSent->new(return_value => $resp);
lib/Dancer/Plugin/StreamData.pm view on Meta::CPAN
# This routine will be called by Dancer, and will be passed the status code
# and headers that have been determined for the response being assembled. Its
# job is to return a callback that will in turn be called at the proper time
# to begin streaming the data. Unfortunately, it will be called *twice*, the
# second time with an improper status code and headers. Consequently, we must
# ignore the second invocation.
sub prepare_stream {
my ($status, $headers) = @_;
# Store the status and headers we were given, because the callback that
# does the actual streaming will have to present them directly to the PSGI
# interface. We have no way of actually getting that information to it
# other than a private variable (declared above).
# The variable $stream_status is made undefined by the stream_data()
# function (see above) and so we only set it if it has not been set
lib/Dancer/Plugin/StreamData.pm view on Meta::CPAN
}
}
}
# Tell Dancer that it should call the function stream_callback() when
# ready for streaming to begin.
return \&stream_callback;
}
=pod
lib/Dancer/Plugin/StreamData.pm view on Meta::CPAN
erroneously report that the connection was closed prematurely before all of
the data was sent.
=cut
# This subroutine is called at the proper time for data streaming to begin.
# It is passed a callback according to the PSGI standard that can be called to
# procure a writer object to which we can actually write the data a chunk at a
# time. As each chunk is written, it is sent off to the client as part of the
# response body.
lib/Dancer/Plugin/StreamData.pm view on Meta::CPAN
$stream_object->$stream_call($writer);
}
}
=head2 server_supports_streaming
This function returns true if the server you are working with supports
PSGI-style streaming, false otherwise.
Here is an example of how you might use it:
if ( server_supports_streaming ) {
stream_data($query, 'streamResult');
} else {
return $query->generateResult();
}
=cut
register 'server_supports_streaming' => sub {
my $env = Dancer::SharedData->request->env;
return 1 if $env->{'psgi.streaming'};
return undef; # otherwise
};
register_plugin;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Dancer.pm view on Meta::CPAN
my $env = Dancer::SharedData->request->env;
my $request = Dancer::Request->new_for_request('GET' => $path);
Dancer::SharedData->request($request);
# if you asked for streaming but it's not supported in PSGI
if ( $options{'streaming'} && ! $env->{'psgi.streaming'} ) {
# TODO: throw a fit (AKA "exception") or a Dancer::Error?
raise core => 'Sorry, streaming is not supported on this server.';
}
if (exists($options{content_type})) {
$request->content_type($options{content_type});
}
lib/Dancer.pm view on Meta::CPAN
$resp->push_header('Content-Disposition' =>
"attachment; filename=\"$options{filename}\""
);
}
if ( $options{'streaming'} ) {
# handle streaming
$resp->streamed( sub {
my ( $status, $headers ) = @_;
my %callbacks = defined $options{'callbacks'} ?
%{ $options{'callbacks'} } :
();
lib/Dancer.pm view on Meta::CPAN
# This code will be ignored
do_stuff();
}
};
Send file supports streaming possibility using PSGI streaming. The server should
support it but normal streaming is supported on most, if not all.
get '/download/:file' => sub {
send_file( params->{file}, streaming => 1 );
}
You can control what happens using callbacks.
First, C<around_content> allows you to get the writer object and the chunk of
content read, and then decide what to do with each chunk:
get '/download/:file' => sub {
send_file(
params->{file},
streaming => 1,
callbacks => {
around_content => sub {
my ( $writer, $chunk ) = @_;
$writer->write("* $chunk");
},
lib/Dancer.pm view on Meta::CPAN
it:
get '/download/:file' => sub {
send_file(
params->{file},
streaming => 1,
callbacks => {
around => sub {
my ( $writer, $content ) = @_;
# we know it's a text file, so we'll just stream
lib/Dancer.pm view on Meta::CPAN
},
},
);
}
Or you could use C<override> to control the entire streaming callback request:
get '/download/:file' => sub {
send_file(
params->{file},
streaming => 1,
callbacks => {
override => sub {
my ( $respond, $response ) = @_;
my $writer = $respond->( [ $newstatus, $newheaders ] );
lib/Dancer.pm view on Meta::CPAN
42K bytes) using C<bytes>:
get '/download/:file' => sub {
send_file(
params->{file},
streaming => 1,
bytes => 524288, # 512K
);
};
The content-type will be set depending on the current MIME types definition
view all matches for this distribution