File Coverage

blib/lib/MongoDB/Role/_DatabaseOp.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 28 28 100.0


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 60     60   65210 use strict;
  60         123  
  60         14676  
16 60     60   284 use warnings;
  60         110  
  60         1765  
17             package MongoDB::Role::_DatabaseOp;
18              
19             # MongoDB role for operations within a database, that need a database name
20             # and a BSON codec. This is likely a "base role" for all operations.
21              
22 60     60   292 use version;
  60         114  
  60         343  
23             our $VERSION = 'v2.2.2';
24              
25 60     60   4015 use Moo::Role;
  60         157  
  60         334  
26              
27 60         504 use MongoDB::_Types qw(
28             Boolish
29             BSONCodec
30             ClientSession
31             Stringish
32 60     60   19544 );
  60         120  
33 60         394 use Types::Standard qw(
34             CodeRef
35             Maybe
36 60     60   86249 );
  60         117  
37              
38 60     60   42545 use namespace::clean;
  60         129  
  60         465  
39              
40             has bson_codec => (
41             is => 'ro',
42             required => 1,
43             isa => BSONCodec,
44             );
45              
46             has db_name => (
47             is => 'ro',
48             required => 1,
49             isa => Stringish,
50             );
51              
52             # required, but allowed to be undef so we're sure this gets wired up
53             # correctly through all database ops.
54             has monitoring_callback => (
55             is => 'ro',
56             required => 1,
57             isa => Maybe[CodeRef],
58             );
59              
60             has session => (
61             is => 'ro',
62             required => 0,
63             isa => Maybe[ClientSession],
64             );
65              
66             # set during retryable writes on supported operations
67             has retryable_write => (
68             is => 'rw',
69             isa => Boolish,
70             default => 0,
71             );
72              
73             # set during retryable reads on supported operations
74             has retryable_read => (
75             is => 'rw',
76             isa => Boolish,
77             default => 0,
78             );
79              
80             1;