The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DataStore::CAS::FS::DirCodec::Unix - Efficiently encode only the attributes of a UNIX stat()

VERSION

version 0.0101

DESCRIPTION

This directory encoder/decoder encodes only the fields of a DirEnt corresponding to a unix stat_t structure. (or more precisely, the fields perl returns from the stat function) Any other fields in the DirEnt are ignored.

It does this much more efficiently than would be done in JSON, but still uses text, to avoid complications of endian-ness and word size. (and because 32-bit perl can't numerically process 64-bit integers) The encoding is further optimized by ordering the fields by likelyhood of being used, and truncating records at the last used field.

It also imposes some restrictions: 'name' and 'ref' must each be less than 256 bytes when encoded as UTF-8. There is also a limitation on the unix stat values, but they will all fit even with max-length 64 bit integers, so this shouldn't ever be a problem.

METHODS

encode

  $serialized= $class->encode( \@entries, \%metadata )

See DirCodec->encode for details.

decode

  my $dir= $class->decode( \%params )

See DirCodec->load for details on %params.

AUTHOR

Michael Conrad <mconrad@intellitree.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Michael Conrad, and IntelliTree Solutions llc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.