| 1 | package Zing::Node; | ||||||||||
| 2 | |||||||||||
| 3 | 49 | ▶ | use 5.014; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 49 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 49 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 49 | ▶ | use registry 'Zing::Types'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 49 | ▶ | use routines; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 49 | ▶ | use Data::Object::Class; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 49 | ▶ | use Data::Object::ClassHas; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 49 | ▶ | use Zing::Server; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 49 | our $VERSION = '0.11'; # VERSION | |||||||||
| 17 | |||||||||||
| 18 | # ATTRIBUTES | ||||||||||
| 19 | |||||||||||
| 20 | 49 | my ($i, $t) = (0, time); | |||||||||
| 21 | |||||||||||
| 22 | 49 | has 'name' => ( | |||||||||
| 23 | is => 'ro', | ||||||||||
| 24 | isa => 'Str', | ||||||||||
| 25 | new => 1, | ||||||||||
| 26 | ); | ||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | fun new_name($self) { | ||||||||
|
Subroutine
new_name: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 29 | 0 | ▶ | my $name = join(':', time, sprintf('%04d', ($i = ($t == time ? $i + 1 : 1)))); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | |||||||||||
| 31 | # reset iota | ||||||||||
| 32 | 0 | $t = time; | |||||||||
| 33 | |||||||||||
| 34 | 0 | $name | |||||||||
| 35 | 49 | } | |||||||||
| 36 | |||||||||||
| 37 | 49 | has 'pid' => ( | |||||||||
| 38 | is => 'ro', | ||||||||||
| 39 | isa => 'Str', | ||||||||||
| 40 | new => 1, | ||||||||||
| 41 | ); | ||||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | fun new_pid($self) { | ||||||||
|
Subroutine
new_pid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 44 | 0 | $$ | |||||||||
| 45 | 49 | } | |||||||||
| 46 | |||||||||||
| 47 | 49 | has 'server' => ( | |||||||||
| 48 | is => 'ro', | ||||||||||
| 49 | isa => 'Server', | ||||||||||
| 50 | new => 1, | ||||||||||
| 51 | ); | ||||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | fun new_server($self) { | ||||||||
|
Subroutine
new_server: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 54 | 0 | Zing::Server->new | |||||||||
| 55 | 49 | } | |||||||||
| 56 | |||||||||||
| 57 | # METHODS | ||||||||||
| 58 | |||||||||||
| 59 | 0 | ▶ | method identifier() { | ||||||||
|
Subroutine
identifier: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 60 | |||||||||||
| 61 | 0 | return join ':', $self->server->name, $self->pid, $self->name; | |||||||||
| 62 | 49 | } | |||||||||
| 63 | |||||||||||
| 64 | 49 | 1; | |||||||||
| 65 | |||||||||||
| 66 | =encoding utf8 | ||||||||||
| 67 | |||||||||||
| 68 | =head1 NAME | ||||||||||
| 69 | |||||||||||
| 70 | Zing::Node - Node Information | ||||||||||
| 71 | |||||||||||
| 72 | =cut | ||||||||||
| 73 | |||||||||||
| 74 | =head1 ABSTRACT | ||||||||||
| 75 | |||||||||||
| 76 | Process Node Information | ||||||||||
| 77 | |||||||||||
| 78 | =cut | ||||||||||
| 79 | |||||||||||
| 80 | =head1 SYNOPSIS | ||||||||||
| 81 | |||||||||||
| 82 | use Zing::Node; | ||||||||||
| 83 | |||||||||||
| 84 | my $node = Zing::Node->new; | ||||||||||
| 85 | |||||||||||
| 86 | =cut | ||||||||||
| 87 | |||||||||||
| 88 | =head1 DESCRIPTION | ||||||||||
| 89 | |||||||||||
| 90 | This package provides represents a process within a network and cluster. | ||||||||||
| 91 | |||||||||||
| 92 | =cut | ||||||||||
| 93 | |||||||||||
| 94 | =head1 LIBRARIES | ||||||||||
| 95 | |||||||||||
| 96 | This package uses type constraints from: | ||||||||||
| 97 | |||||||||||
| 98 | L<Zing::Types> | ||||||||||
| 99 | |||||||||||
| 100 | =cut | ||||||||||
| 101 | |||||||||||
| 102 | =head1 ATTRIBUTES | ||||||||||
| 103 | |||||||||||
| 104 | This package has the following attributes: | ||||||||||
| 105 | |||||||||||
| 106 | =cut | ||||||||||
| 107 | |||||||||||
| 108 | =head2 name | ||||||||||
| 109 | |||||||||||
| 110 | name(Str) | ||||||||||
| 111 | |||||||||||
| 112 | This attribute is read-only, accepts C<(Str)> values, and is optional. | ||||||||||
| 113 | |||||||||||
| 114 | =cut | ||||||||||
| 115 | |||||||||||
| 116 | =head2 pid | ||||||||||
| 117 | |||||||||||
| 118 | pid(Str) | ||||||||||
| 119 | |||||||||||
| 120 | This attribute is read-only, accepts C<(Str)> values, and is optional. | ||||||||||
| 121 | |||||||||||
| 122 | =cut | ||||||||||
| 123 | |||||||||||
| 124 | =head2 server | ||||||||||
| 125 | |||||||||||
| 126 | server(Server) | ||||||||||
| 127 | |||||||||||
| 128 | This attribute is read-only, accepts C<(Server)> values, and is optional. | ||||||||||
| 129 | |||||||||||
| 130 | =cut | ||||||||||
| 131 | |||||||||||
| 132 | =head1 METHODS | ||||||||||
| 133 | |||||||||||
| 134 | This package implements the following methods: | ||||||||||
| 135 | |||||||||||
| 136 | =cut | ||||||||||
| 137 | |||||||||||
| 138 | =head2 identifier | ||||||||||
| 139 | |||||||||||
| 140 | identifier() : Str | ||||||||||
| 141 | |||||||||||
| 142 | The identifier method generates and returns a cross-cluster unique identifier. | ||||||||||
| 143 | |||||||||||
| 144 | =over 4 | ||||||||||
| 145 | |||||||||||
| 146 | =item identifier example #1 | ||||||||||
| 147 | |||||||||||
| 148 | # given: synopsis | ||||||||||
| 149 | |||||||||||
| 150 | my $id = $node->identifier; | ||||||||||
| 151 | |||||||||||
| 152 | =back | ||||||||||
| 153 | |||||||||||
| 154 | =cut | ||||||||||
| 155 | |||||||||||
| 156 | =head1 AUTHOR | ||||||||||
| 157 | |||||||||||
| 158 | Al Newkirk, C<awncorp@cpan.org> | ||||||||||
| 159 | |||||||||||
| 160 | =head1 LICENSE | ||||||||||
| 161 | |||||||||||
| 162 | Copyright (C) 2011-2019, Al Newkirk, et al. | ||||||||||
| 163 | |||||||||||
| 164 | This is free software; you can redistribute it and/or modify it under the terms | ||||||||||
| 165 | of the The Apache License, Version 2.0, as elucidated in the L<"license | ||||||||||
| 166 | file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>. | ||||||||||
| 167 | |||||||||||
| 168 | =head1 PROJECT | ||||||||||
| 169 | |||||||||||
| 170 | L<Wiki|https://github.com/iamalnewkirk/zing/wiki> | ||||||||||
| 171 | |||||||||||
| 172 | L<Project|https://github.com/iamalnewkirk/zing> | ||||||||||
| 173 | |||||||||||
| 174 | L<Initiatives|https://github.com/iamalnewkirk/zing/projects> | ||||||||||
| 175 | |||||||||||
| 176 | L<Milestones|https://github.com/iamalnewkirk/zing/milestones> | ||||||||||
| 177 | |||||||||||
| 178 | L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md> | ||||||||||
| 179 | |||||||||||
| 180 | L<Issues|https://github.com/iamalnewkirk/zing/issues> | ||||||||||
| 181 | |||||||||||
| 182 | =cut | ||||||||||