line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright 2014 - present MongoDB, Inc. |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
4
|
|
|
|
|
|
|
# you may not use this file except in compliance with the License. |
5
|
|
|
|
|
|
|
# You may obtain a copy of the License at |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software |
10
|
|
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
11
|
|
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12
|
|
|
|
|
|
|
# See the License for the specific language governing permissions and |
13
|
|
|
|
|
|
|
# limitations under the License. |
14
|
|
|
|
|
|
|
|
15
|
58
|
|
|
58
|
|
190450
|
use strict; |
|
58
|
|
|
|
|
149
|
|
|
58
|
|
|
|
|
1827
|
|
16
|
58
|
|
|
58
|
|
324
|
use warnings; |
|
58
|
|
|
|
|
129
|
|
|
58
|
|
|
|
|
2096
|
|
17
|
|
|
|
|
|
|
package MongoDB::Role::_WriteOp; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# MongoDB interface for database write operations (whether write commands |
20
|
|
|
|
|
|
|
# or other things that take a write concern) |
21
|
|
|
|
|
|
|
|
22
|
58
|
|
|
58
|
|
318
|
use version; |
|
58
|
|
|
|
|
126
|
|
|
58
|
|
|
|
|
309
|
|
23
|
|
|
|
|
|
|
our $VERSION = 'v2.2.0'; |
24
|
|
|
|
|
|
|
|
25
|
58
|
|
|
58
|
|
4377
|
use Moo::Role; |
|
58
|
|
|
|
|
163
|
|
|
58
|
|
|
|
|
486
|
|
26
|
|
|
|
|
|
|
|
27
|
58
|
|
|
|
|
594
|
use MongoDB::_Types qw( |
28
|
|
|
|
|
|
|
WriteConcern |
29
|
58
|
|
|
58
|
|
22366
|
); |
|
58
|
|
|
|
|
152
|
|
30
|
|
|
|
|
|
|
|
31
|
58
|
|
|
58
|
|
64601
|
use namespace::clean; |
|
58
|
|
|
|
|
157
|
|
|
58
|
|
|
|
|
379
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has write_concern => ( |
34
|
|
|
|
|
|
|
is => 'ro', |
35
|
|
|
|
|
|
|
required => 1, |
36
|
|
|
|
|
|
|
isa => WriteConcern, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _should_use_acknowledged_write { |
40
|
0
|
|
|
0
|
|
|
my $self = shift; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# We should never use an unacknowledged write concern in an active transaction |
43
|
0
|
0
|
0
|
|
|
|
return 1 if $self->session && $self->session->_active_transaction; |
44
|
0
|
|
|
|
|
|
return $self->write_concern->is_acknowledged; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |