Yenta.pm untested

filter: Statementstmt 0.0% 0 / 4 Branchbran n/a Conditioncond n/a Subroutinesub 0.0% 0 / 1 Podpod n/a totaltotal 0.0% 0 / 5 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
CRAP 2.0
1 # -*- perl -*-
2  
3 # Copyright (c) 2010 AdCopy
4 # Author: Jeff Weisberg
5 # Created: 2010-May-13 18:18 (EDT)
6 # Function: documentation
7 #
8 # $Id: Yenta.pm,v 1.6 2011/01/12 19:29:22 jaw Exp $
9  
10 package AC::Yenta;
11 use strict;
12  
13 our $VERSION = 1;
14  
15 =head1 NAME
16  
17 AC::Yenta - eventually-consistent distributed key/value data store. et al.
18  
19 =head1 SYNOPSIS
20  
21 use AC::Yenta::D;
22 use strict;
23  
24 my $y = AC::Yenta::D->new( );
25  
26 $y->daemon( $configfile, {
27 argv => \@ARGV,
28 foreground => $OPT{f},
29 debugall => $OPT{d},
30 port => $OPT{p},
31 } );
32  
33 exit;
34  
35  
36 =head1 USAGE
37  
38 Copy + Paste from the example code into your own code.
39 Copy + Paste from the example config into your own config.
40 Send in bug report.
41  
42 =head1 YIDDISH-ENGLISH GLOSSARY
43  
44 Kibitz - Gossip. Casual information exchange with ones peers.
45  
46 Yenta - 1. An old woman who kibitzes with other yentas.
47 2. Software which kibitzes with other yentas.
48  
49  
50 =head1 DESCRIPTION
51  
52 =head2 Peers
53  
54 All of the running yentas are peers. There is no master server.
55 New nodes can be added or removed on the fly with no configuration.
56  
57 =head2 Kibitzing
58  
59 Each yenta kibitzes (gossips) with the other yentas in the network
60 to exchange status information, distribute key-value data, and
61 detect and correct inconsistent data.
62  
63 =head2 Eventual Consistency
64  
65 Key-value data is versioned with timestamps. By default, newest wins.
66 Maps can be configured to keep and return multiple versions and client
67 code can use other conflict resolution mechanisms.
68  
69 Lost, missing or otherwise inconsistent data is detected
70 by kibitzing merkle tree hash values.
71  
72 =head2 Topological awareness
73  
74 Yentas can take network topology into account when tranferring
75 data around to minimize long-distance transfers. You will need to
76 write a custom C<MySelf> class with a C<my_datacenter> function.
77  
78 =head2 Multiple Network Interfaces / NAT
79  
80 Yentas can take advantage of multiple network interfaces with
81 different IP addresses (eg. a private internal network + a public network),
82 or multiple addresses (eg. a private addresses and a public address)
83 and various NAT configurations.
84  
85 You will need to write a custom C<MySelf> class and C<my_network_info>
86 function.
87  
88 =head2 Network Information
89  
90 By default, yentas obtain their primary IP address by calling
91 C<gethostbyname( hostname() )>. If this either does not work on your
92 systems, or isn't the value you want to use,
93 you will need to write a custom C<MySelf> class and C<my_network_info>
94 function.
95  
96  
97  
98 =head1 CONFIG FILE
99  
100 various parameters need to be specified in a config file.
101 if you modify the file, it will be reloaded automagically.
102  
103 =over 4
104  
105 =item port
106  
107 specify the TCP port to use
108  
109 port 3503
110  
111 =item environment
112  
113 specify the environment or realm to run in, so you can run multiple
114 independent yenta networks, such as production, staging, and dev.
115  
116 environment prod
117  
118 =item allow
119  
120 specify networks allowed to connect.
121  
122 allow 127.0.0.1
123 allow 192.168.10.0/24
124  
125 =item seedpeer
126  
127 specify initial peers to contact when starting. the author generally
128 specifies 2 on the east coast, and 2 on the west coast.
129  
130 seedpeer 192.168.10.11:3503
131 seedpeer 192.168.10.12:3503
132  
133 =item secret
134  
135 specify a secret key used to encrypt data transfered between
136 yentas in different datacenters.
137  
138 secret squeamish-ossifrage
139  
140 =item syslog
141  
142 specify a syslog facility for log messages.
143  
144 syslog local5
145  
146 =item debug
147  
148 enable debugging for a particular section
149  
150 debug map
151  
152 =item map
153  
154 configure a map (a collection of key-value data). you do not need
155 to configure the same set of maps on all servers. maps should be
156 configured similarly on all servers that they are on.
157  
158 map users {
159 backend bdb
160 dbfile /home/acdata/users.ydb
161 history 4
162 }
163  
164 =back
165  
166 =head1 BUGS
167  
168 Too many to list here.
169  
170 =head1 SEE ALSO
171  
172 AC::Yenta::Client
173  
174 Amazon Dynamo - http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html
175  
176 =head1 AUTHOR
177  
178 Jeff Weisberg - http://www.solvemedia.com/
179  
180 =cut
181  
182 1;