line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ArangoDB2; |
2
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
492166
|
use strict; |
|
20
|
|
|
|
|
65
|
|
|
20
|
|
|
|
|
762
|
|
4
|
20
|
|
|
20
|
|
82
|
use warnings; |
|
20
|
|
|
|
|
33
|
|
|
20
|
|
|
|
|
789
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
7
|
|
|
|
|
|
|
|
8
|
20
|
|
|
20
|
|
10842
|
use URI; |
|
20
|
|
|
|
|
78031
|
|
|
20
|
|
|
|
|
548
|
|
9
|
|
|
|
|
|
|
|
10
|
20
|
|
|
20
|
|
7391
|
use ArangoDB2::Admin; |
|
20
|
|
|
|
|
55
|
|
|
20
|
|
|
|
|
515
|
|
11
|
20
|
|
|
20
|
|
7257
|
use ArangoDB2::Database; |
|
20
|
|
|
|
|
53
|
|
|
20
|
|
|
|
|
567
|
|
12
|
20
|
|
|
20
|
|
6859
|
use ArangoDB2::Endpoint; |
|
20
|
|
|
|
|
40
|
|
|
20
|
|
|
|
|
459
|
|
13
|
20
|
|
|
20
|
|
6561
|
use ArangoDB2::HTTP; |
|
20
|
|
|
|
|
55
|
|
|
20
|
|
|
|
|
6299
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# new |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
# create new ArangoDB2 instance from string argument specifying |
20
|
|
|
|
|
|
|
# API endpoint or hashref of args |
21
|
|
|
|
|
|
|
sub new |
22
|
|
|
|
|
|
|
{ |
23
|
19
|
|
|
19
|
1
|
197
|
my $class = shift; |
24
|
|
|
|
|
|
|
# create instance |
25
|
19
|
|
|
|
|
43
|
my $self = {}; |
26
|
19
|
|
|
|
|
45
|
bless($self, $class); |
27
|
|
|
|
|
|
|
# for now only accept single string arg |
28
|
19
|
|
|
|
|
86
|
$self->uri(@_); |
29
|
|
|
|
|
|
|
|
30
|
19
|
|
|
|
|
74
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# admin |
34
|
|
|
|
|
|
|
# |
35
|
|
|
|
|
|
|
# ArangoDB2::Admin object which provides access to methods in |
36
|
|
|
|
|
|
|
# the /_admin group |
37
|
|
|
|
|
|
|
sub admin |
38
|
|
|
|
|
|
|
{ |
39
|
2
|
|
|
2
|
1
|
2570
|
my($self) = @_; |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
33
|
|
|
36
|
return $self->{admin} ||= ArangoDB2::Admin->new($self); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# database |
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
# ArangoDB2::Database object which provides access to methods |
47
|
|
|
|
|
|
|
# in the /_api/database group |
48
|
|
|
|
|
|
|
sub database |
49
|
|
|
|
|
|
|
{ |
50
|
25
|
|
|
25
|
1
|
3667
|
my($self, $name) = @_; |
51
|
|
|
|
|
|
|
# default database for arango is _system |
52
|
25
|
|
100
|
|
|
109
|
$name ||= "_system"; |
53
|
|
|
|
|
|
|
# only create one instance per ArangoDB2 per database, each ArangoDB2 |
54
|
|
|
|
|
|
|
# keeps its own instances since they may have different credentials |
55
|
25
|
|
66
|
|
|
77
|
return $self->databases->{$name} ||= ArangoDB2::Database->new($self, $name); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# databases |
59
|
|
|
|
|
|
|
# |
60
|
|
|
|
|
|
|
# Index of active ArangoDB2::Database objects by name |
61
|
25
|
|
100
|
25
|
1
|
474
|
sub databases { $_[0]->{databases} ||= {} } |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# endpoint |
64
|
|
|
|
|
|
|
# |
65
|
|
|
|
|
|
|
# ArangoDB2::Endpoint object |
66
|
|
|
|
|
|
|
sub endpoint |
67
|
|
|
|
|
|
|
{ |
68
|
1
|
|
|
1
|
1
|
5
|
my($self, $name) = @_; |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
13
|
return ArangoDB2::Endpoint->new($self, $name); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# http |
74
|
|
|
|
|
|
|
# |
75
|
|
|
|
|
|
|
# ArangoDB2::HTTP object. This provides normalized interface to |
76
|
|
|
|
|
|
|
# various HTTP clients. |
77
|
|
|
|
|
|
|
sub http |
78
|
|
|
|
|
|
|
{ |
79
|
1
|
|
|
1
|
1
|
2
|
my($self, $http) = @_; |
80
|
|
|
|
|
|
|
|
81
|
1
|
50
|
|
|
|
5
|
$self->{http} = $http |
82
|
|
|
|
|
|
|
if defined $http; |
83
|
|
|
|
|
|
|
|
84
|
1
|
|
33
|
|
|
11
|
return $self->{http} ||= ArangoDB2::HTTP->new($self); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# uri |
88
|
|
|
|
|
|
|
# |
89
|
|
|
|
|
|
|
# get/set URI for API |
90
|
|
|
|
|
|
|
sub uri |
91
|
|
|
|
|
|
|
{ |
92
|
20
|
|
|
20
|
1
|
44
|
my($self, $uri) = @_; |
93
|
|
|
|
|
|
|
|
94
|
20
|
100
|
|
|
|
206
|
$self->{uri} = URI->new($uri) |
95
|
|
|
|
|
|
|
if defined $uri; |
96
|
|
|
|
|
|
|
|
97
|
20
|
|
|
|
|
124185
|
return $self->{uri}; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# version |
101
|
|
|
|
|
|
|
# |
102
|
|
|
|
|
|
|
# GET /_api/version |
103
|
|
|
|
|
|
|
# |
104
|
|
|
|
|
|
|
# Returns the server name and version number. The response is a JSON object with the following attributes: |
105
|
|
|
|
|
|
|
# |
106
|
|
|
|
|
|
|
# server: will always contain arango |
107
|
|
|
|
|
|
|
# version: the server version string. The string has the format "major.minor.sub". major and minor will be numeric, and sub may contain a number or a textual version. |
108
|
|
|
|
|
|
|
# details: an optional JSON object with additional details. This is returned only if the details URL parameter is set to true in the request. |
109
|
|
|
|
|
|
|
sub version |
110
|
|
|
|
|
|
|
{ |
111
|
0
|
|
|
0
|
1
|
0
|
my($self) = @_; |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
0
|
return $self->http->get('/_api/version'); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# _class |
117
|
|
|
|
|
|
|
# |
118
|
|
|
|
|
|
|
# internal name for class |
119
|
52
|
|
|
52
|
|
204
|
sub _class { 'arango' } |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
__END__ |