File Coverage

blib/lib/Filesys/POSIX/Mem.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 25 27 92.5


line stmt bran cond sub pod time code
1             # Copyright (c) 2014, cPanel, Inc.
2             # All rights reserved.
3             # http://cpanel.net/
4             #
5             # This is free software; you can redistribute it and/or modify it under the same
6             # terms as Perl itself. See the LICENSE file for further details.
7              
8             package Filesys::POSIX::Mem;
9              
10 26     26   454 use strict;
  26         27  
  26         527  
11 26     26   73 use warnings;
  26         19  
  26         517  
12              
13 26     26   6815 use Filesys::POSIX::Bits;
  26         37  
  26         6091  
14 26     26   8833 use Filesys::POSIX::Mem::Inode ();
  26         53  
  26         2898  
15              
16             =head1 NAME
17              
18             Filesys::POSIX::Mem - Filesystem whose logical structure resides solely in
19             program memory
20              
21             =head1 DESCRIPTION
22              
23             C provides a filesystem whose structure and, to a large
24             extent, contents of regular files, exist solely in program memory as Perl data
25             structures and string buffers. Regular file data up to a certain size can exist
26             entirely in memory; files exceeding that size are dumped to temporary files
27             backed by L.
28              
29             =head1 MOUNT OPTIONS
30              
31             =over
32              
33             =item C
34              
35             Allows one to specify the directory in which temporary bucket files which back
36             regular file data are to be created and kept.
37              
38             =item C
39              
40             Specifies the maximum size, in bytes, of a regular file as it is kept in memory
41             before being flushed to a bucket file in disk. The default value is, as per
42             L, C<16384> bytes.
43              
44             =back
45              
46             =cut
47              
48             sub new {
49 42     42 0 1326055 my ($class) = @_;
50 42         91 my $fs = bless {}, $class;
51              
52 42         242 $fs->{'root'} = Filesys::POSIX::Mem::Inode->new(
53             'mode' => $S_IFDIR | 0755,
54             'dev' => $fs
55             );
56              
57 42         196 return $fs;
58             }
59              
60             sub init {
61 39     39 0 61 my ( $self, %flags ) = @_;
62              
63 39         65 $self->{'flags'} = \%flags;
64              
65 39         120 return $self;
66             }
67              
68             =head1 SEE ALSO
69              
70             =over
71              
72             =item L
73              
74             C implementation of the inode construct.
75              
76             =item L
77              
78             C implementation of file handles associated with regular
79             file data.
80              
81             =item L
82              
83             C implementation of directory iterable directory structures
84             as defined by the L interface.
85              
86             =back
87              
88             =cut
89              
90             1;
91              
92             __END__