The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::YUID::Client - Client for distributed YUID generation

SYNOPSIS

    use Data::YUID::Client;
    my $client = Data::YUID::Client->new(
            servers => [
                '192.168.100.4:11001',
                '192.168.100.5:11001',
            ],
        );
    my $id = $client->get_id;

DESCRIPTION

Data::YUID::Client is a client for the client/server protocol used to generate distributed unique IDs. bin/yuidd implements the server portion of the protocol.

USAGE

Data::YUID::Client->new(%param)

Creates a new client object, initialized with %param, and returns the new object.

%param can contain:

  • servers

    A reference to a list of server addresses, in host:port notation. These should point to the locations of servers running the yuidd server using the client/server protocol for ID generation.

    New Behavior: the original version of this would create a connection to every server at new() and cache them all. This version creates only one connection, when the first YUID is requested, and caches that connection. If the connection goes bad, it'll try other servers it its list until one works or until it has worked through the list.

$client->get_id([ $namespace ])

Obtains a unique ID from one of the servers, in the optional namespace $namespace.

Returns undef if it can't get an ID from any server.

AUTHOR & COPYRIGHT

Please see the Data::YUID manpage for author, copyright, and license information.