| 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 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 26 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 26 | ▶ | use Filesys::POSIX::Bits; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 26 | ▶ | use Filesys::POSIX::Mem::Inode (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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<Filesys::POSIX::Mem> 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<File::Temp>. | ||
| 28 | |||
| 29 | =head1 MOUNT OPTIONS | ||
| 30 | |||
| 31 | =over | ||
| 32 | |||
| 33 | =item C<bucket_dir> | ||
| 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<bucket_max> | ||
| 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<Filesys::POSIX::Mem::Inode>, C<16384> bytes. | ||
| 43 | |||
| 44 | =back | ||
| 45 | |||
| 46 | =cut | ||
| 47 | |||
| 48 | 42 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 49 | 42 | my ($class) = @_; | |
| 50 | 42 | my $fs = bless {}, $class; | |
| 51 | |||
| 52 | 42 | $fs->{'root'} = Filesys::POSIX::Mem::Inode->new( | |
| 53 | 'mode' => $S_IFDIR | 0755, | ||
| 54 | 'dev' => $fs | ||
| 55 | ); | ||
| 56 | |||
| 57 | 42 | return $fs; | |
| 58 | } | ||
| 59 | |||
| 60 | 39 | ▶ | sub init { |
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 61 | 39 | my ( $self, %flags ) = @_; | |
| 62 | |||
| 63 | 39 | $self->{'flags'} = \%flags; | |
| 64 | |||
| 65 | 39 | return $self; | |
| 66 | } | ||
| 67 | |||
| 68 | =head1 SEE ALSO | ||
| 69 | |||
| 70 | =over | ||
| 71 | |||
| 72 | =item L<Filesys::POSIX::Mem::Inode> | ||
| 73 | |||
| 74 | C<Filesys::POSIX::Mem> implementation of the inode construct. | ||
| 75 | |||
| 76 | =item L<Filesys::POSIX::Mem::Bucket> | ||
| 77 | |||
| 78 | C<Filesys::POSIX::Mem> implementation of file handles associated with regular | ||
| 79 | file data. | ||
| 80 | |||
| 81 | =item L<Filesys::POSIX::Mem::Directory> | ||
| 82 | |||
| 83 | C<Filesys::POSIX::Mem> implementation of directory iterable directory structures | ||
| 84 | as defined by the L<Filesys::POSIX::Directory> interface. | ||
| 85 | |||
| 86 | =back | ||
| 87 | |||
| 88 | =cut | ||
| 89 | |||
| 90 | 26 | 1; | |
| 91 | |||
| 92 | __END__ | ||