line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ArangoDB2; |
2
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
463094
|
use strict; |
|
21
|
|
|
|
|
36
|
|
|
21
|
|
|
|
|
785
|
|
4
|
21
|
|
|
21
|
|
83
|
use warnings; |
|
21
|
|
|
|
|
26
|
|
|
21
|
|
|
|
|
603
|
|
5
|
|
|
|
|
|
|
|
6
|
21
|
|
|
|
|
7785
|
use base qw( |
7
|
|
|
|
|
|
|
ArangoDB2::Base |
8
|
21
|
|
|
21
|
|
89
|
); |
|
21
|
|
|
|
|
27
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
11
|
|
|
|
|
|
|
|
12
|
21
|
|
|
21
|
|
11292
|
use URI; |
|
21
|
|
|
|
|
75873
|
|
|
21
|
|
|
|
|
609
|
|
13
|
|
|
|
|
|
|
|
14
|
21
|
|
|
21
|
|
8014
|
use ArangoDB2::Admin; |
|
21
|
|
|
|
|
38
|
|
|
21
|
|
|
|
|
492
|
|
15
|
21
|
|
|
21
|
|
6994
|
use ArangoDB2::Database; |
|
21
|
|
|
|
|
57
|
|
|
21
|
|
|
|
|
621
|
|
16
|
21
|
|
|
21
|
|
6928
|
use ArangoDB2::Endpoint; |
|
21
|
|
|
|
|
64
|
|
|
21
|
|
|
|
|
477
|
|
17
|
21
|
|
|
21
|
|
6853
|
use ArangoDB2::HTTP; |
|
21
|
|
|
|
|
59
|
|
|
21
|
|
|
|
|
8836
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# new |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
# create new ArangoDB2 instance from string argument specifying |
24
|
|
|
|
|
|
|
# API endpoint or hashref of args |
25
|
|
|
|
|
|
|
sub new |
26
|
|
|
|
|
|
|
{ |
27
|
19
|
|
|
19
|
1
|
311
|
my($class, $uri, $username, $password) = @_; |
28
|
|
|
|
|
|
|
# create instance |
29
|
19
|
|
|
|
|
48
|
my $self = {}; |
30
|
19
|
|
|
|
|
47
|
bless($self, $class); |
31
|
|
|
|
|
|
|
# set values |
32
|
19
|
|
|
|
|
82
|
$self->uri($uri); |
33
|
19
|
|
|
|
|
99
|
$self->username($username); |
34
|
19
|
|
|
|
|
71
|
$self->password($password); |
35
|
|
|
|
|
|
|
|
36
|
19
|
|
|
|
|
70
|
return $self; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# admin |
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
# ArangoDB2::Admin object which provides access to methods in |
42
|
|
|
|
|
|
|
# the /_admin group |
43
|
|
|
|
|
|
|
sub admin |
44
|
|
|
|
|
|
|
{ |
45
|
2
|
|
|
2
|
1
|
2905
|
my($self) = @_; |
46
|
|
|
|
|
|
|
|
47
|
2
|
|
|
|
|
28
|
return ArangoDB2::Admin->new($self); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# database |
51
|
|
|
|
|
|
|
# |
52
|
|
|
|
|
|
|
# ArangoDB2::Database object which provides access to methods |
53
|
|
|
|
|
|
|
# in the /_api/database group |
54
|
|
|
|
|
|
|
sub database |
55
|
|
|
|
|
|
|
{ |
56
|
25
|
|
|
25
|
1
|
5147
|
my($self, $name) = @_; |
57
|
|
|
|
|
|
|
# default database for arango is _system |
58
|
25
|
|
100
|
|
|
110
|
$name ||= "_system"; |
59
|
|
|
|
|
|
|
# only create one instance per ArangoDB2 per database, each ArangoDB2 |
60
|
|
|
|
|
|
|
# keeps its own instances since they may have different credentials |
61
|
25
|
|
66
|
|
|
1401
|
return $self->databases->{$name} ||= ArangoDB2::Database->new($self, $name); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# databases |
65
|
|
|
|
|
|
|
# |
66
|
|
|
|
|
|
|
# Index of active ArangoDB2::Database objects by name |
67
|
25
|
|
100
|
25
|
1
|
495
|
sub databases { $_[0]->{databases} ||= {} } |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# endpoint |
70
|
|
|
|
|
|
|
# |
71
|
|
|
|
|
|
|
# ArangoDB2::Endpoint object |
72
|
|
|
|
|
|
|
sub endpoint |
73
|
|
|
|
|
|
|
{ |
74
|
2
|
|
|
2
|
1
|
9
|
my($self, $name) = @_; |
75
|
|
|
|
|
|
|
|
76
|
2
|
|
|
|
|
18
|
return ArangoDB2::Endpoint->new($self, $name); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# http |
80
|
|
|
|
|
|
|
# |
81
|
|
|
|
|
|
|
# ArangoDB2::HTTP object. This provides normalized interface to |
82
|
|
|
|
|
|
|
# various HTTP clients. |
83
|
|
|
|
|
|
|
sub http |
84
|
|
|
|
|
|
|
{ |
85
|
1
|
|
|
1
|
1
|
2
|
my($self, $http) = @_; |
86
|
|
|
|
|
|
|
|
87
|
1
|
50
|
|
|
|
3
|
$self->{http} = $http |
88
|
|
|
|
|
|
|
if defined $http; |
89
|
|
|
|
|
|
|
|
90
|
1
|
|
33
|
|
|
10
|
return $self->{http} ||= ArangoDB2::HTTP->new($self); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# http_client |
94
|
|
|
|
|
|
|
# |
95
|
|
|
|
|
|
|
# set string indicating http client to use |
96
|
|
|
|
|
|
|
sub http_client { |
97
|
1
|
|
|
1
|
1
|
1
|
my($self) = shift; |
98
|
|
|
|
|
|
|
# get/set http client value |
99
|
1
|
50
|
|
|
|
5
|
my $http_client = $self->_get_set('http_client', @_) |
100
|
|
|
|
|
|
|
or return; |
101
|
|
|
|
|
|
|
# flush current http client instance so that it will be |
102
|
|
|
|
|
|
|
# re-created using the correct client |
103
|
0
|
|
|
|
|
0
|
$self->{http} = undef; |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
0
|
return $http_client; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# uri |
109
|
|
|
|
|
|
|
# |
110
|
|
|
|
|
|
|
# get/set URI for API |
111
|
|
|
|
|
|
|
sub uri |
112
|
|
|
|
|
|
|
{ |
113
|
20
|
|
|
20
|
1
|
49
|
my($self, $uri) = @_; |
114
|
|
|
|
|
|
|
|
115
|
20
|
100
|
|
|
|
186
|
$self->{uri} = URI->new($uri) |
116
|
|
|
|
|
|
|
if defined $uri; |
117
|
|
|
|
|
|
|
|
118
|
20
|
|
|
|
|
129170
|
return $self->{uri}; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# version |
122
|
|
|
|
|
|
|
# |
123
|
|
|
|
|
|
|
# GET /_api/version |
124
|
|
|
|
|
|
|
# |
125
|
|
|
|
|
|
|
# Returns the server name and version number. The response is a JSON object with the following attributes: |
126
|
|
|
|
|
|
|
# |
127
|
|
|
|
|
|
|
# server: will always contain arango |
128
|
|
|
|
|
|
|
# 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. |
129
|
|
|
|
|
|
|
# details: an optional JSON object with additional details. This is returned only if the details URL parameter is set to true in the request. |
130
|
|
|
|
|
|
|
sub version |
131
|
|
|
|
|
|
|
{ |
132
|
0
|
|
|
0
|
1
|
0
|
my($self) = @_; |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
0
|
return $self->http->get('/_api/version'); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#################### |
138
|
|
|
|
|
|
|
# PROPERTY METHODS # |
139
|
|
|
|
|
|
|
#################### |
140
|
|
|
|
|
|
|
|
141
|
20
|
|
|
20
|
1
|
183
|
sub username { shift->_get_set('username', @_) } |
142
|
19
|
|
|
19
|
1
|
67
|
sub password { shift->_get_set('password', @_) } |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
#################### |
145
|
|
|
|
|
|
|
# INTERNAL METHODS # |
146
|
|
|
|
|
|
|
#################### |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
# _class |
149
|
|
|
|
|
|
|
# |
150
|
|
|
|
|
|
|
# internal name for class |
151
|
53
|
|
|
53
|
|
208
|
sub _class { 'arango' } |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
1; |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
__END__ |