| 1 | package ArangoDB2::Collection; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 22 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 22 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 22 | ▶ | use base qw( | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | ArangoDB2::Base | ||||||||||||||||||||||||||||
| 8 | 22 | ); | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 22 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 22 | ▶ | use JSON::XS; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 22 | ▶ | use ArangoDB2::Document; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 22 | ▶ | use ArangoDB2::Edge; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 22 | ▶ | use ArangoDB2::Index; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 22 | my $JSON = JSON::XS->new->utf8; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | # params that can be set when creating collection | ||||||||||||||||||||||||||||
| 20 | 22 | my @PARAMS = qw( | |||||||||||||||||||||||||||
| 21 | doCompact isSystem isVolatile journalSize keyOptions name | ||||||||||||||||||||||||||||
| 22 | numberOfShards shardKeys type waitForSync | ||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | # checksum | ||||||||||||||||||||||||||||
| 28 | # | ||||||||||||||||||||||||||||
| 29 | # GET /_api/collection/{collection-name}/checksum | ||||||||||||||||||||||||||||
| 30 | sub checksum | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
checksum: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | 0 | my($self, $args) = @_; | |||||||||||||||||||||||||||
| 33 | # process args | ||||||||||||||||||||||||||||
| 34 | 0 | $args = $self->_build_args($args, ['withData','withRevisions']); | |||||||||||||||||||||||||||
| 35 | # make request | ||||||||||||||||||||||||||||
| 36 | 0 | return $self->arango->http->get( | |||||||||||||||||||||||||||
| 37 | $self->api_path('collection', $self->name, 'checksum'), | ||||||||||||||||||||||||||||
| 38 | $args, | ||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | # count | ||||||||||||||||||||||||||||
| 43 | # | ||||||||||||||||||||||||||||
| 44 | # get/set count | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub count { shift->_get_set_bool('count', @_) } | ||||||||||||||||||||||||||
|
Subroutine
count: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | # create | ||||||||||||||||||||||||||||
| 48 | # | ||||||||||||||||||||||||||||
| 49 | # POST /_api/collection | ||||||||||||||||||||||||||||
| 50 | # | ||||||||||||||||||||||||||||
| 51 | # return self on success, undef on failure | ||||||||||||||||||||||||||||
| 52 | sub create | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
create: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 54 | 0 | my($self, $args) = @_; | |||||||||||||||||||||||||||
| 55 | # process args | ||||||||||||||||||||||||||||
| 56 | 0 | $args = $self->_build_args($args, \@PARAMS); | |||||||||||||||||||||||||||
| 57 | # make request | ||||||||||||||||||||||||||||
| 58 | 0 | ▶ | my $res = $self->arango->http->post( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | $self->api_path('collection'), | ||||||||||||||||||||||||||||
| 60 | undef, | ||||||||||||||||||||||||||||
| 61 | $JSON->encode($args), | ||||||||||||||||||||||||||||
| 62 | ) or return; | ||||||||||||||||||||||||||||
| 63 | # copy response data to instance | ||||||||||||||||||||||||||||
| 64 | 0 | $self->_build_self($res, [@PARAMS, 'id']); | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | return $self; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | # delete | ||||||||||||||||||||||||||||
| 70 | # | ||||||||||||||||||||||||||||
| 71 | # DELETE /_api/collection/{collection-name} | ||||||||||||||||||||||||||||
| 72 | sub delete | ||||||||||||||||||||||||||||
| 73 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 74 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | return $self->arango->http->delete( | |||||||||||||||||||||||||||
| 77 | $self->api_path('collection', $self->name), | ||||||||||||||||||||||||||||
| 78 | ); | ||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | # document | ||||||||||||||||||||||||||||
| 82 | # | ||||||||||||||||||||||||||||
| 83 | # get a specific ArangoDB2::Document by name (_key) or create a | ||||||||||||||||||||||||||||
| 84 | # new blank ArangoDB2::Document | ||||||||||||||||||||||||||||
| 85 | sub document | ||||||||||||||||||||||||||||
| 86 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
document: called CC=3 SCAR=15.1
Pod
documented
| |||||||||||||||||||||||||||||
| 87 | 3 | my($self, $name) = @_; | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | # if name (_key) is passed then instantiate a new | ||||||||||||||||||||||||||||
| 90 | # object with that name, which will retrieve the object | ||||||||||||||||||||||||||||
| 91 | 3 | ▶ | if (defined $name) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 0 | ▶ | return $self->documents->{$name} ||= ArangoDB2::Document->new( | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->documents->{$name} ||= "ArangoDB2::Document"->new($self->arango, $self->database, $self, $name)
MC/DC0%0/2
$self->documents->{$name} ||= "ArangoDB2::Document"->new($self->arango, $self->database, $self, $name)
$self->documents->{$name}
"ArangoDB2::Document"->new($self->arango, $self->database, $self, $name)
Truth table0%0/3
A ||= B
A= $self->documents->{$name}B= "ArangoDB2::Document"->new($self->arango, $self->database, $self, $name)
| |||||||||||||||||||||||||||||
| 93 | $self->arango, | ||||||||||||||||||||||||||||
| 94 | $self->database, | ||||||||||||||||||||||||||||
| 95 | $self, | ||||||||||||||||||||||||||||
| 96 | $name, | ||||||||||||||||||||||||||||
| 97 | ); | ||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | # otherwise create a new empty document that can be used to | ||||||||||||||||||||||||||||
| 100 | # create a new document | ||||||||||||||||||||||||||||
| 101 | else { | ||||||||||||||||||||||||||||
| 102 | 3 | return ArangoDB2::Document->new( | |||||||||||||||||||||||||||
| 103 | $self->arango, | ||||||||||||||||||||||||||||
| 104 | $self->database, | ||||||||||||||||||||||||||||
| 105 | $self, | ||||||||||||||||||||||||||||
| 106 | ); | ||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | # documents | ||||||||||||||||||||||||||||
| 111 | # | ||||||||||||||||||||||||||||
| 112 | # register of ArangoDB2::Document objects by name (_key) | ||||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub documents { $_[0]->{documents} ||= {} } | ||||||||||||||||||||||||||
|
Subroutine
documents: not called CC=2 SCAR=17.9
Pod
documented
Condition0%0/2
$_[0]{"documents"} ||= {}
MC/DC0%0/1
$_[0]{"documents"} ||= {}
$_[0]{"documents"}
Truth table0%0/2
A
A= $_[0]{"documents"}
| |||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | # documentCount | ||||||||||||||||||||||||||||
| 116 | # | ||||||||||||||||||||||||||||
| 117 | # GET /_api/collection/{collection-name}/count | ||||||||||||||||||||||||||||
| 118 | sub documentCount | ||||||||||||||||||||||||||||
| 119 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
documentCount: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 120 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 0 | return $self->arango->http->get( | |||||||||||||||||||||||||||
| 123 | $self->api_path('collection', $self->name, 'count'), | ||||||||||||||||||||||||||||
| 124 | ); | ||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | # doCompact | ||||||||||||||||||||||||||||
| 128 | # | ||||||||||||||||||||||||||||
| 129 | # get/set doCompact | ||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub doCompact { shift->_get_set_bool('doCompact', @_) } | ||||||||||||||||||||||||||
|
Subroutine
doCompact: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | # edge | ||||||||||||||||||||||||||||
| 133 | # | ||||||||||||||||||||||||||||
| 134 | # get a specific ArangoDB2::Edge by name (_key) or create a | ||||||||||||||||||||||||||||
| 135 | # new blank ArangoDB2::Edge | ||||||||||||||||||||||||||||
| 136 | sub edge | ||||||||||||||||||||||||||||
| 137 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
edge: called CC=3 SCAR=15.1
Pod
documented
| |||||||||||||||||||||||||||||
| 138 | 1 | my($self, $name) = @_; | |||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | # if name (_key) is passed then instantiate a new | ||||||||||||||||||||||||||||
| 141 | # object with that name, which will retrieve the object | ||||||||||||||||||||||||||||
| 142 | 1 | ▶ | if (defined $name) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | return $self->edges->{$name} ||= ArangoDB2::Edge->new( | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->edges->{$name} ||= "ArangoDB2::Edge"->new($self->arango, $self->database, $self, $name)
MC/DC0%0/2
$self->edges->{$name} ||= "ArangoDB2::Edge"->new($self->arango, $self->database, $self, $name)
$self->edges->{$name}
"ArangoDB2::Edge"->new($self->arango, $self->database, $self, $name)
Truth table0%0/3
A ||= B
A= $self->edges->{$name}B= "ArangoDB2::Edge"->new($self->arango, $self->database, $self, $name)
| |||||||||||||||||||||||||||||
| 144 | $self->arango, | ||||||||||||||||||||||||||||
| 145 | $self->database, | ||||||||||||||||||||||||||||
| 146 | $self, | ||||||||||||||||||||||||||||
| 147 | $name, | ||||||||||||||||||||||||||||
| 148 | ); | ||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | # otherwise create a new empty document that can be used to | ||||||||||||||||||||||||||||
| 151 | # create a new document | ||||||||||||||||||||||||||||
| 152 | else { | ||||||||||||||||||||||||||||
| 153 | 1 | return ArangoDB2::Edge->new( | |||||||||||||||||||||||||||
| 154 | $self->arango, | ||||||||||||||||||||||||||||
| 155 | $self->database, | ||||||||||||||||||||||||||||
| 156 | $self, | ||||||||||||||||||||||||||||
| 157 | ); | ||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | # edges | ||||||||||||||||||||||||||||
| 162 | # | ||||||||||||||||||||||||||||
| 163 | # register of ArangoDB2::Edge objects by name (_key) | ||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub edges { $_[0]->{edges} ||= {} } | ||||||||||||||||||||||||||
|
Subroutine
edges: not called CC=2 SCAR=17.9
Pod
documented
Condition0%0/2
$_[0]{"edges"} ||= {}
MC/DC0%0/1
$_[0]{"edges"} ||= {}
$_[0]{"edges"}
Truth table0%0/2
A
A= $_[0]{"edges"}
| |||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | # excludeSystem | ||||||||||||||||||||||||||||
| 167 | # | ||||||||||||||||||||||||||||
| 168 | # get/set excludeSystem | ||||||||||||||||||||||||||||
| 169 | 0 | ▶ | sub excludeSystem { shift->_get_set_bool('excludeSystem', @_) } | ||||||||||||||||||||||||||
|
Subroutine
excludeSystem: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | # figures | ||||||||||||||||||||||||||||
| 172 | # | ||||||||||||||||||||||||||||
| 173 | # GET /_api/collection/{collection-name}/figures | ||||||||||||||||||||||||||||
| 174 | sub figures | ||||||||||||||||||||||||||||
| 175 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
figures: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 176 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | return $self->arango->http->get( | |||||||||||||||||||||||||||
| 179 | $self->api_path('collection', $self->name, 'figures'), | ||||||||||||||||||||||||||||
| 180 | ); | ||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | # index | ||||||||||||||||||||||||||||
| 184 | # | ||||||||||||||||||||||||||||
| 185 | # get an ArangoDB::Index by name or create new empty instance | ||||||||||||||||||||||||||||
| 186 | sub index | ||||||||||||||||||||||||||||
| 187 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
index: called CC=3 SCAR=15.1
Pod
documented
| |||||||||||||||||||||||||||||
| 188 | 1 | my($self, $name) = @_; | |||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | # if name then create/retrieve named instance | ||||||||||||||||||||||||||||
| 191 | 1 | ▶ | if (defined $name) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 0 | ▶ | return $self->indexes->{$name} ||= ArangoDB2::Index->new( | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->indexes->{$name} ||= "ArangoDB2::Index"->new($self->arango, $self->database, $self, $name)
MC/DC0%0/2
$self->indexes->{$name} ||= "ArangoDB2::Index"->new($self->arango, $self->database, $self, $name)
$self->indexes->{$name}
"ArangoDB2::Index"->new($self->arango, $self->database, $self, $name)
Truth table0%0/3
A ||= B
A= $self->indexes->{$name}B= "ArangoDB2::Index"->new($self->arango, $self->database, $self, $name)
| |||||||||||||||||||||||||||||
| 193 | $self->arango, | ||||||||||||||||||||||||||||
| 194 | $self->database, | ||||||||||||||||||||||||||||
| 195 | $self, | ||||||||||||||||||||||||||||
| 196 | $name, | ||||||||||||||||||||||||||||
| 197 | ); | ||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | # otherwise create a new empty instance | ||||||||||||||||||||||||||||
| 200 | else { | ||||||||||||||||||||||||||||
| 201 | 1 | return ArangoDB2::Index->new( | |||||||||||||||||||||||||||
| 202 | $self->arango, | ||||||||||||||||||||||||||||
| 203 | $self->database, | ||||||||||||||||||||||||||||
| 204 | $self, | ||||||||||||||||||||||||||||
| 205 | ); | ||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | # indexes | ||||||||||||||||||||||||||||
| 210 | # | ||||||||||||||||||||||||||||
| 211 | # register of ArangoDB2::Index objects by name | ||||||||||||||||||||||||||||
| 212 | 0 | ▶ | sub indexes { $_[0]->{indexes} ||= {} } | ||||||||||||||||||||||||||
|
Subroutine
indexes: not called CC=2 SCAR=17.9
Pod
documented
Condition0%0/2
$_[0]{"indexes"} ||= {}
MC/DC0%0/1
$_[0]{"indexes"} ||= {}
$_[0]{"indexes"}
Truth table0%0/2
A
A= $_[0]{"indexes"}
| |||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | # info | ||||||||||||||||||||||||||||
| 215 | # | ||||||||||||||||||||||||||||
| 216 | # GET /_api/collection/{collection-name} | ||||||||||||||||||||||||||||
| 217 | sub info | ||||||||||||||||||||||||||||
| 218 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
info: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 219 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | return $self->arango->http->get( | |||||||||||||||||||||||||||
| 222 | $self->api_path('collection', $self->name), | ||||||||||||||||||||||||||||
| 223 | ); | ||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | # isSystem | ||||||||||||||||||||||||||||
| 227 | # | ||||||||||||||||||||||||||||
| 228 | # get/set isSystem | ||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub isSystem { shift->_get_set_bool('isSystem', @_) } | ||||||||||||||||||||||||||
|
Subroutine
isSystem: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | # isVolatile | ||||||||||||||||||||||||||||
| 232 | # | ||||||||||||||||||||||||||||
| 233 | # get/set isVolatile | ||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub isVolatile { shift->_get_set_bool('isVolatile', @_) } | ||||||||||||||||||||||||||
|
Subroutine
isVolatile: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | # journalSize | ||||||||||||||||||||||||||||
| 237 | # | ||||||||||||||||||||||||||||
| 238 | # get/set journalSize | ||||||||||||||||||||||||||||
| 239 | 0 | ▶ | sub journalSize { shift->_get_set('journalSize', @_) } | ||||||||||||||||||||||||||
|
Subroutine
journalSize: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | # keyOptions | ||||||||||||||||||||||||||||
| 242 | # | ||||||||||||||||||||||||||||
| 243 | # get/set keyOptions | ||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub keyOptions { shift->_get_set('keyOptions', @_) } | ||||||||||||||||||||||||||
|
Subroutine
keyOptions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | # list | ||||||||||||||||||||||||||||
| 247 | # | ||||||||||||||||||||||||||||
| 248 | # GET /_api/collection | ||||||||||||||||||||||||||||
| 249 | sub list | ||||||||||||||||||||||||||||
| 250 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
list: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 251 | 0 | my($self, $args) = @_; | |||||||||||||||||||||||||||
| 252 | # process args | ||||||||||||||||||||||||||||
| 253 | 0 | $args = $self->_build_args($args, ['excludeSystem']); | |||||||||||||||||||||||||||
| 254 | # make request | ||||||||||||||||||||||||||||
| 255 | 0 | return $self->arango->http->get( | |||||||||||||||||||||||||||
| 256 | $self->api_path('collection'), | ||||||||||||||||||||||||||||
| 257 | $args, | ||||||||||||||||||||||||||||
| 258 | ); | ||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | # load | ||||||||||||||||||||||||||||
| 262 | # | ||||||||||||||||||||||||||||
| 263 | # PUT /_api/collection/{collection-name}/load | ||||||||||||||||||||||||||||
| 264 | sub load | ||||||||||||||||||||||||||||
| 265 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
load: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 266 | 0 | my($self, $args) = @_; | |||||||||||||||||||||||||||
| 267 | # process args | ||||||||||||||||||||||||||||
| 268 | 0 | $args = $self->_build_args($args, ['count']); | |||||||||||||||||||||||||||
| 269 | # make request | ||||||||||||||||||||||||||||
| 270 | 0 | return $self->arango->http->put( | |||||||||||||||||||||||||||
| 271 | $self->api_path('collection', $self->name, 'load'), | ||||||||||||||||||||||||||||
| 272 | $args, | ||||||||||||||||||||||||||||
| 273 | ); | ||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | # numberOfShards | ||||||||||||||||||||||||||||
| 277 | # | ||||||||||||||||||||||||||||
| 278 | # get/set numberOfShards | ||||||||||||||||||||||||||||
| 279 | 0 | ▶ | sub numberOfShards { shift->_get_set('numberOfShards', @_) } | ||||||||||||||||||||||||||
|
Subroutine
numberOfShards: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | # properties | ||||||||||||||||||||||||||||
| 282 | # | ||||||||||||||||||||||||||||
| 283 | # GET /_api/collection/{collection-name}/properties | ||||||||||||||||||||||||||||
| 284 | # | ||||||||||||||||||||||||||||
| 285 | # or | ||||||||||||||||||||||||||||
| 286 | # | ||||||||||||||||||||||||||||
| 287 | # PUT /_api/collection/{collection-name}/properties | ||||||||||||||||||||||||||||
| 288 | sub properties | ||||||||||||||||||||||||||||
| 289 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
properties: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 290 | 0 | my($self, $args) = @_; | |||||||||||||||||||||||||||
| 291 | # process args | ||||||||||||||||||||||||||||
| 292 | 0 | $args = $self->_build_args($args, ['journalSize', 'waitForSync']); | |||||||||||||||||||||||||||
| 293 | # build path | ||||||||||||||||||||||||||||
| 294 | 0 | my $path = $self->api_path('collection', $self->name, 'properties'); | |||||||||||||||||||||||||||
| 295 | # make request | ||||||||||||||||||||||||||||
| 296 | 0 | ▶ | my $res = %$args | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 297 | # if args are passed then set with PUT | ||||||||||||||||||||||||||||
| 298 | ? $self->arango->http->put($path, undef, $JSON->encode($args)) | ||||||||||||||||||||||||||||
| 299 | # otherwise get properties | ||||||||||||||||||||||||||||
| 300 | : $self->arango->http->get($path); | ||||||||||||||||||||||||||||
| 301 | # copy response data to instance | ||||||||||||||||||||||||||||
| 302 | 0 | $self->_build_self($res, \@PARAMS); | |||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | 0 | return $self; | |||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | # rename | ||||||||||||||||||||||||||||
| 308 | # | ||||||||||||||||||||||||||||
| 309 | # PUT /_api/collection/{collection-name}/rename | ||||||||||||||||||||||||||||
| 310 | sub rename | ||||||||||||||||||||||||||||
| 311 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
rename: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 312 | 0 | my($self, $args) = @_; | |||||||||||||||||||||||||||
| 313 | # make a copy of current name | ||||||||||||||||||||||||||||
| 314 | 0 | my $old_name = $self->name; | |||||||||||||||||||||||||||
| 315 | # process args | ||||||||||||||||||||||||||||
| 316 | 0 | $args = $self->_build_args($args, ['name']); | |||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | 0 | my $res = $self->arango->http->put( | |||||||||||||||||||||||||||
| 319 | $self->api_path('collection', $self->name, 'rename'), | ||||||||||||||||||||||||||||
| 320 | undef, | ||||||||||||||||||||||||||||
| 321 | $JSON->encode($args), | ||||||||||||||||||||||||||||
| 322 | ); | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | # if rename successful apply changes locally | ||||||||||||||||||||||||||||
| 325 | 0 | ▶ | if ($res && $res->{name} eq $args->{name}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$res and $res->{"name"} eq $args->{"name"}
MC/DC0%0/2
$res and $res->{"name"} eq $args->{"name"}
$res
$res->{"name"} eq $args->{"name"}
Truth table0%0/3
A and B
A= $resB= $res->{"name"} eq $args->{"name"}
| |||||||||||||||||||||||||||||
| 326 | # change internal name | ||||||||||||||||||||||||||||
| 327 | 0 | $self->name($res->{name}); | |||||||||||||||||||||||||||
| 328 | # unregister old name | ||||||||||||||||||||||||||||
| 329 | 0 | delete $self->database->collections->{$old_name}; | |||||||||||||||||||||||||||
| 330 | # register new name | ||||||||||||||||||||||||||||
| 331 | 0 | $self->database->collections->{ $res->{name} } = $self; | |||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | 0 | return $self; | |||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | # revision | ||||||||||||||||||||||||||||
| 338 | # | ||||||||||||||||||||||||||||
| 339 | # GET /_api/collection/{collection-name}/revision | ||||||||||||||||||||||||||||
| 340 | sub revision | ||||||||||||||||||||||||||||
| 341 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
revision: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 342 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | 0 | return $self->arango->http->get( | |||||||||||||||||||||||||||
| 345 | $self->api_path('collection', $self->name, 'revision'), | ||||||||||||||||||||||||||||
| 346 | ); | ||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | # rotate | ||||||||||||||||||||||||||||
| 350 | # | ||||||||||||||||||||||||||||
| 351 | # PUT /_api/collection/{collection-name}/rotate | ||||||||||||||||||||||||||||
| 352 | sub rotate | ||||||||||||||||||||||||||||
| 353 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
rotate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 354 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | 0 | return $self->arango->http->put( | |||||||||||||||||||||||||||
| 357 | $self->api_path('collection', $self->name, 'rotate'), | ||||||||||||||||||||||||||||
| 358 | ); | ||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | # shardKeys | ||||||||||||||||||||||||||||
| 362 | # | ||||||||||||||||||||||||||||
| 363 | # get/set shardKeys | ||||||||||||||||||||||||||||
| 364 | 0 | ▶ | sub shardKeys { shift->_get_set('shardKeys', @_) } | ||||||||||||||||||||||||||
|
Subroutine
shardKeys: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | # truncate | ||||||||||||||||||||||||||||
| 367 | # | ||||||||||||||||||||||||||||
| 368 | # PUT /_api/collection/{collection-name}/truncate | ||||||||||||||||||||||||||||
| 369 | sub truncate | ||||||||||||||||||||||||||||
| 370 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
truncate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 371 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | 0 | return $self->arango->http->put( | |||||||||||||||||||||||||||
| 374 | $self->api_path('collection', $self->name, 'truncate'), | ||||||||||||||||||||||||||||
| 375 | ); | ||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | # type | ||||||||||||||||||||||||||||
| 379 | # | ||||||||||||||||||||||||||||
| 380 | # get/set type | ||||||||||||||||||||||||||||
| 381 | 0 | ▶ | sub type { shift->_get_set('type', @_) } | ||||||||||||||||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | # unload | ||||||||||||||||||||||||||||
| 384 | # | ||||||||||||||||||||||||||||
| 385 | # PUT /_api/collection/{collection-name}/unload | ||||||||||||||||||||||||||||
| 386 | sub unload | ||||||||||||||||||||||||||||
| 387 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
unload: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 388 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | 0 | return $self->arango->http->put( | |||||||||||||||||||||||||||
| 391 | $self->api_path('collection', $self->name, 'unload'), | ||||||||||||||||||||||||||||
| 392 | ); | ||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | # waitForSync | ||||||||||||||||||||||||||||
| 396 | # | ||||||||||||||||||||||||||||
| 397 | # get/set waitForSync | ||||||||||||||||||||||||||||
| 398 | 0 | ▶ | sub waitForSync { shift->_get_set_bool('waitForSync', @_) } | ||||||||||||||||||||||||||
|
Subroutine
waitForSync: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | # withData | ||||||||||||||||||||||||||||
| 401 | # | ||||||||||||||||||||||||||||
| 402 | # get/set withData | ||||||||||||||||||||||||||||
| 403 | 0 | ▶ | sub withData { shift->_get_set_bool('withData', @_) } | ||||||||||||||||||||||||||
|
Subroutine
withData: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | # withRevisions | ||||||||||||||||||||||||||||
| 406 | # | ||||||||||||||||||||||||||||
| 407 | # get/set withRevisions | ||||||||||||||||||||||||||||
| 408 | 0 | ▶ | sub withRevisions { shift->_get_set_bool('withRevisions', @_) } | ||||||||||||||||||||||||||
|
Subroutine
withRevisions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | # _class | ||||||||||||||||||||||||||||
| 411 | # | ||||||||||||||||||||||||||||
| 412 | # internal name for class | ||||||||||||||||||||||||||||
| 413 | 5 | ▶ | sub _class { 'collection' } | ||||||||||||||||||||||||||
|
Subroutine
_class: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | 22 | 1; | |||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||
| 417 | __END__ | ||||||||||||||||||||||||||||