File Coverage

blib/lib/Avro/DataFile.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition 1 2 50.0
subroutine 5 5 100.0
pod 0 1 0.0
total 21 23 91.3


line stmt bran cond sub pod time code
1             # Licensed to the Apache Software Foundation (ASF) under one
2             # or more contributor license agreements. See the NOTICE file
3             # distributed with this work for additional information
4             # regarding copyright ownership. The ASF licenses this file
5             # to you under the Apache License, Version 2.0 (the
6             # "License"); you may not use this file except in compliance
7             # with the License. You may obtain a copy of the License at
8             #
9             # https://www.apache.org/licenses/LICENSE-2.0
10             #
11             # Unless required by applicable law or agreed to in writing,
12             # software distributed under the License is distributed on an
13             # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14             # KIND, either express or implied. See the License for the
15             # specific language governing permissions and limitations
16             # under the License.
17              
18             use strict;
19 1     1   19691 use warnings;
  1         6  
  1         23  
20 1     1   4  
  1         2  
  1         27  
21             use constant AVRO_MAGIC => "Obj\x01";
22 1     1   5  
  1         1  
  1         49  
23             use Avro::Schema;
24 1     1   416  
  1         2  
  1         103  
25             our $VERSION = '1.11.1';
26              
27             our $HEADER_SCHEMA = Avro::Schema->parse(<<EOH);
28             {"type": "record", "name": "org.apache.avro.file.Header",
29             "fields" : [
30             {"name": "magic", "type": {"type": "fixed", "name": "Magic", "size": 4}},
31             {"name": "meta", "type": {"type": "map", "values": "bytes"}},
32             {"name": "sync", "type": {"type": "fixed", "name": "Sync", "size": 16}}
33             ]
34             }
35             EOH
36              
37             our %ValidCodec = (
38             null => 1,
39             deflate => 1,
40             bzip2 => 1,
41             zstandard => 1,
42             );
43              
44             my $datafile = shift;
45             my $codec = shift || '';
46 12     12 0 17 return $ValidCodec{$codec};
47 12   50     31 }
48 12         46  
49             +1;