README
1NAME
2 DBIx::Class::InflateColumn::FS - Inflate/deflate columns to
3 Path::Class::File objects
4
5SYNOPSIS
6 __PACKAGE__->load_components(qw/InflateColumn::FS Core/);
7 __PACKAGE__->add_columns(
8 id => {
9 data_type => 'INT',
10 is_auto_increment => 1,
11 },
12 file => {
13 data_type => 'TEXT',
14 is_fs_column => 1,
15 fs_column_path => '/var/lib/myapp/myfiles',
16 },
17 file_2 => {
18 data_type => 'TEXT',
19 is_fs_column => 1,
20 fs_column_path => '/var/lib/myapp/myfiles',
21 fs_new_on_update => 1
22 },
23 );
24 __PACKAGE__->set_primary_key('id');
25
26 # in application code
27 $rs->create({ file => $file_handle });
28
29 $row = $rs->find({ id => $id });
30 my $fh = $row->file->open('r');
31
32DESCRIPTION
33 Provides inflation to a Path::Class::File object allowing file system
34 storage of BLOBS.
35
36 The storage path is specified with "fs_column_path". Each file receives
37 a unique name, so the storage for all FS columns can share the same
38 path.
39
40 Within the path specified by "fs_column_path", files are stored in
41 sub-directories based on the first 2 characters of the unique file
42 names. Up to 256 sub-directories will be created, as needed. Override
43 "_fs_column_dirs" in a derived class to change this behavior.
44
45 "fs_new_on_update" will create a new file name if the file has been
46 updated.
47
48METHODS
49 inflate_result
50 register_column
51 fs_file_name
52 Provides the file naming algorithm. Override this method to change it.
53
54 This method is called with two parameters: The name of the column and
55 the "column_info" object.
56
57 _fs_column_dirs
58 Returns the sub-directory components for a given file name. Override it
59 to provide a deeper directory tree or change the algorithm.
60
61 copy
62 Copies a row object, duplicating the files backing fs columns.
63
64 delete
65 Deletes the associated file system storage when a row is deleted.
66
67 set_column
68 Deletes file storage when an fs_column is set to undef.
69
70 set_inflated_column
71 Re-inflates after setting an fs_column.
72
73 _inflate_fs_column
74 Inflates a file column to a Path::Class::File object.
75
76 _deflate_fs_column
77 Deflates a file column to its storage path name, relative to
78 "fs_column_path". In the database, a file column is just a place holder
79 for inflation/deflation. The actual file lives in the file system.
80
81 table
82 Overridden to provide a hook for specifying the resultset_class. If you
83 provide your own resultset_class, inherit from
84 InflateColumn::FS::ResultSet.
85
86SUPPORT
87 Community support can be found via:
88
89 Mailing list: http://lists.scsys.co.uk/mailman/listinfo/dbix-class/
90
91 IRC: irc.perl.org#dbix-class
92
93 The author is "semifor" on IRC and a member of the mailing list.
94
95AUTHOR
96 semifor: Marc Mims <marc@questright.com>
97
98CONTRIBUTORS
99 mst: Matt S. Trout <mst@shadowcatsystems.co.uk>
100
101 mo: Moritz Onken <onken@netcubed.de>
102
103 norbi: Norbert Buchmuller <norbi@nix.hu>
104
105LICENSE
106 You may distribute this code under the same terms as Perl itself.
107
108