GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Kafka::Int64(3) User Contributed Perl Documentation Kafka::Int64(3)

Kafka::Int64 - Functions to work with 64 bit elements of the protocol on 32 bit systems.

This documentation refers to "Kafka::Int64" version 0.8010 .

    use 5.010;
    use strict;
    use warnings;

    use Scalar::Util qw(
        blessed
    );
    use Try::Tiny;

    use Kafka qw(
        $BITS64
    );

    try {

        # Apache Kafka Protocol: FetchOffset, Time

        my $offset = 123;

        my $encoded = $BITS64
            ? pack( 'q>', $offset )
            : Kafka::Int64::packq( $offset );

        my $response = chr( 0 ) x 8;

        $offset = $BITS64
            ? unpack( 'q>', substr( $response, 0, 8 ) )
            : Kafka::Int64::unpackq( substr( $response, 0, 8 ) );

        my $next_offset = $BITS64
            ? $offset + 1
            : Kafka::Int64::intsum( $offset, 1 );

    } catch {
        if ( blessed( $_ ) && $_->isa( 'Kafka::Exception' ) ) {
            warn 'Error: (', $_->code, ') ',  $_->message, "\n";
            exit;
        } else {
            die $_;
        }
    };

This module is not intended to be used by end user.

In order to achieve better performance, functions of this module do not perform validation of arguments.

Transparent BigInteger support on 32-bit platforms where native integer type is limited to 32 bits and slow bigint must be used instead. Use functions from this module in such case.

The main features of the "Kafka::Int64" module are:

Support for working with 64 bit elements of the Kafka protocol on 32 bit systems.

The following functions are available for the "Kafka::Int64" module.

"intsum( $bint, $int )"

Adds two numbers to emulate bigint adding 64-bit integers in 32-bit systems.

The both arguments must be a number. That is, it is defined and Perl thinks it's a number. Arguments may be a Math::BigInt integers.

Returns the value as a Math::BigInt integer.

"packq( $bint )"

Emulates "pack( q{q>}, $bint )" to 32-bit systems - assumes decimal string or integer input.

An argument must be a positive number. That is, it is defined and Perl thinks it's a number. The argument may be a Math::BigInt integer.

The special values -1, -2 are allowed ($Kafka::RECEIVE_LATEST_OFFSET, $Kafka::RECEIVE_EARLIEST_OFFSETS).

Returns the value as a packed binary string.

"unpackq( $bstr )"

Emulates "unpack( q{q>}, $bstr )" to 32-bit systems - assumes binary input.

The argument must be a binary string of 8 bytes length.

Returns the value as a Math::BigInt integer.

When error is detected, an exception, represented by object of "Kafka::Exception::Producer" class, is thrown (see Kafka::Exceptions).

Any error functions is FATAL. FATAL errors will cause the program to halt ("confess"), since the problem is so severe that it would be dangerous to continue.

code and a more descriptive message provide information about thrown exception. Consult documentation of the Kafka::Exceptions for the list of all available methods.

Authors suggest using of Try::Tiny's "try" and "catch" to handle exceptions while working with Kafka package.

"Invalid argument"
This means that you didn't give the right argument to some of the functions.

The basic operation of the Kafka package modules:

Kafka - constants and messages used by the Kafka package modules.

Kafka::Connection - interface to connect to a Kafka cluster.

Kafka::Producer - interface for producing client.

Kafka::Consumer - interface for consuming client.

Kafka::Message - interface to access Kafka message properties.

Kafka::Int64 - functions to work with 64 bit elements of the protocol on 32 bit systems.

Kafka::Protocol - functions to process messages in the Apache Kafka's Protocol.

Kafka::IO - low-level interface for communication with Kafka server.

Kafka::Exceptions - module designated to handle Kafka exceptions.

Kafka::Internals - internal constants and functions used by several package modules.

A wealth of detail about the Apache Kafka and the Kafka Protocol:

Main page at <http://kafka.apache.org/>

Kafka Protocol at <https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol>

Kafka package is hosted on GitHub: <https://github.com/TrackingSoft/Kafka>

Sergey Gladkov, <sgladkov@trackingsoft.com>

Alexander Solovey

Jeremy Jordan

Sergiy Zuban

Vlad Marchenko

Copyright (C) 2012-2013 by TrackingSoft LLC.

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic at <http://dev.perl.org/licenses/artistic.html>.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2015-02-06 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.