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