Zing/KeyVal.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod n/a totaltotal 0.0% 0 / 35 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Zing::KeyVal;
2  
3 use 5.014;
4  
5 use strict;
6 use warnings;
7  
8 use registry 'Zing::Types';
9 use routines;
10  
11 use Data::Object::Class;
12  
13 extends 'Zing::Repo';
14  
15 use Zing::Poll;
16  
17 our $VERSION = '0.26'; # VERSION
18  
19 # METHODS
20  
21 method poll() {
22 return Zing::Poll->new(repo => $self);
23 }
24  
25 method recv() {
26 return $self->store->recv($self->term);
27 }
28  
29 method send(HashRef $value) {
30 return $self->store->send($self->term, $value);
31 }
32  
33 method term() {
34 return $self->app->term($self)->keyval;
35 }
36  
37 1;
38  
39 =encoding utf8
40  
41 =head1 NAME
42  
43 Zing::KeyVal - Key/Value Store
44  
45 =cut
46  
47 =head1 ABSTRACT
48  
49 Generic Key/Value Store
50  
51 =cut
52  
53 =head1 SYNOPSIS
54  
55 use Zing::KeyVal;
56  
57 my $keyval = Zing::KeyVal->new(name => 'notes');
58  
59 # $keyval->recv;
60  
61 =cut
62  
63 =head1 DESCRIPTION
64  
65 This package provides a general-purpose key/value store abstraction.
66  
67 =cut
68  
69 =head1 INHERITS
70  
71 This package inherits behaviors from:
72  
73 L<Zing::Repo>
74  
75 =cut
76  
77 =head1 LIBRARIES
78  
79 This package uses type constraints from:
80  
81 L<Zing::Types>
82  
83 =cut
84  
85 =head1 ATTRIBUTES
86  
87 This package has the following attributes:
88  
89 =cut
90  
91 =head2 name
92  
93 name(Str)
94  
95 This attribute is read-only, accepts C<(Str)> values, and is optional.
96  
97 =cut
98  
99 =head1 METHODS
100  
101 This package implements the following methods:
102  
103 =cut
104  
105 =head2 poll
106  
107 poll() : Poll
108  
109 The poll method returns a L<Zing::Poll> object which can be used to perform a
110 blocking-fetch from the store.
111  
112 =over 4
113  
114 =item poll example #1
115  
116 # given: synopsis
117  
118 $keyval->poll;
119  
120 =back
121  
122 =cut
123  
124 =head2 recv
125  
126 recv() : Maybe[HashRef]
127  
128 The recv method fetches the data (if any) from the store.
129  
130 =over 4
131  
132 =item recv example #1
133  
134 # given: synopsis
135  
136 $keyval->recv;
137  
138 =back
139  
140 =over 4
141  
142 =item recv example #2
143  
144 # given: synopsis
145  
146 $keyval->send({ status => 'happy' });
147  
148 $keyval->recv;
149  
150 =back
151  
152 =cut
153  
154 =head2 send
155  
156 send(HashRef $value) : Str
157  
158 The send method commits data to the store overwriting any existing data.
159  
160 =over 4
161  
162 =item send example #1
163  
164 # given: synopsis
165  
166 $keyval->send({ status => 'happy' });
167  
168 =back
169  
170 =over 4
171  
172 =item send example #2
173  
174 # given: synopsis
175  
176 $keyval->drop;
177  
178 $keyval->send({ status => 'happy' });
179  
180 =back
181  
182 =cut
183  
184 =head2 term
185  
186 term() : Str
187  
188 The term method generates a term (safe string) for the datastore.
189  
190 =over 4
191  
192 =item term example #1
193  
194 # given: synopsis
195  
196 $keyval->term;
197  
198 =back
199  
200 =cut
201  
202 =head1 AUTHOR
203  
204 Al Newkirk, C<awncorp@cpan.org>
205  
206 =head1 LICENSE
207  
208 Copyright (C) 2011-2019, Al Newkirk, et al.
209  
210 This is free software; you can redistribute it and/or modify it under the terms
211 of the The Apache License, Version 2.0, as elucidated in the L<"license
212 file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>.
213  
214 =head1 PROJECT
215  
216 L<Wiki|https://github.com/iamalnewkirk/zing/wiki>
217  
218 L<Project|https://github.com/iamalnewkirk/zing>
219  
220 L<Initiatives|https://github.com/iamalnewkirk/zing/projects>
221  
222 L<Milestones|https://github.com/iamalnewkirk/zing/milestones>
223  
224 L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md>
225  
226 L<Issues|https://github.com/iamalnewkirk/zing/issues>
227  
228 =cut