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 25     25   546 use strict;
  25         27  
  25         745  
11 25     25   101 use warnings;
  25         28  
  25         507  
12              
13 25     25   7011 use Filesys::POSIX::Bits;
  25         35  
  25         7228  
14 25     25   9339 use Filesys::POSIX::Mem::Inode ();
  25         75  
  25         3488  
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 1266052 my ($class) = @_;
50 42         123 my $fs = bless {}, $class;
51              
52 42         285 $fs->{'root'} = Filesys::POSIX::Mem::Inode->new(
53             'mode' => $S_IFDIR | 0755,
54             'dev' => $fs
55             );
56              
57 42         239 return $fs;
58             }
59              
60             sub init {
61 39     39 0 72 my ( $self, %flags ) = @_;
62              
63 39         93 $self->{'flags'} = \%flags;
64              
65 39         217 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__