The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Metadata::File::DB:Base

DESCRIPTION

This module is mostly about setting up the database, and setting default parameters, like the table name, the id column name, etc.

REQUIRES

Metadata::DB::Base

FILE SUBS

These are the base methods to interact with a record.

One is to create a record id, one to retrieve a record id. The third is to provide an id as argument, and to get back where the file *is*- this is essentially for when you get back search results from Metadata::DB::Search

_filesystem_args_get() and _file_id_lookup()

argument is the file id, returns abs path and host id

_file_id_request()

argument is abs path and optionally host_id of machine file is on returns id for this file resource. If it does not exist in the database, it is created/inserted.

_file_id_get()

argument is abs_path and optionally host_id returns id of file or 0 if it's not in the files table

_file_id_create()

argument is abs_path and optionally host_id inserts data and returns id

_file_entry_exists()

argument is id, abs path, and optionally host id returns boolean

   $self->_file_entry_exists( 5, '/home/this/that',3);   
   $self->_file_entry_exists( 5, '/home/this/that');
   

_file_id_clear()

argument is id of a file deletes all data from files table and metadata table

SETUP AND DATABSE SUBS

table_all_reset()

will drop ALL metatada and files locations table and rebuild this is called for re-indexing an entire archive

table_files_check()

checks if table files exists if not creates.

table_files_exists()

returns boolean

table_files_create()

creates files table

table_files_layout()

returns string for creating files table

table_files_dump()

optional argument is limit (number) returns string dump for STDERR

table_files_count()

returns number of entries in files table

SUBS FOR MESSING WITH THE DB

Imagine you have a path, and you want to clear all indexed data fromthere down. Maybe you indexed /home/myself/this/ and you want to drop everything in /home/myself/this/here/

tree_clear()

argument is abs path clears all entries for that path, argument would be a directory on disk

tree_ids()

argument is abs path, returns all ids for files indexed in that path used by tree_clear to easily deduce what should be cleared will use Cwd::abs_path to resolve

AUTHOR

Leo Charre leocharre at cpan dot org