Store.pm untested

filter: Statementstmt 0.0% 0 / 1 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 1 SCAR -
1 package FileMetadata::Store;
2  
3 our $VERSION = '1.0';
4  
5 =head1 NAME
6  
7 FileMetadata::Store
8  
9 =head1 SYNOPSIS
10  
11 An interface to be implemented by Stores in the FileMetadata framework
12  
13 =head1 DESCRIPTION
14  
15 Stores are used to store metadata for use or analysis at a later time.
16 Stores can use SQL databases, flat files or XML as storage. Stores are
17 specific to the FileMetadata framework and are not intended for use as
18 stand alone modules.
19  
20 Stores do not implement any methods to query metadata from stores.
21 It is considered that the use of metadata is application specific
22 and hence is more easily analyzed by the application. It is possible for
23 a Store implementation to implement methods to enable such querying but such
24 methods are beyond the scope of this interface.
25  
26 =head1 METHODS
27  
28 =head2 new
29  
30 This constructor takes a single argument. The argument is a reference to a
31 hash that represents configuration information. The method returns a reference
32 to a new miner object.
33  
34 The exact format for the configuration hash should be available in the
35 documentation for the specific Store module. This hash is generally used to
36 specify which meta information should be stored and which can be ignored.
37 The hash can also be used to transform the keys in the meta information
38 hashes passed to the store() method into less verbose and application
39 specific forms.
40  
41 =head2 store
42  
43 This method stores meta information for later use.
44  
45 This method does not return any thing.
46  
47 This method takes one argument - a reference to a hash that contains meta data
48 known for the resource. The hash contains the key 'ID' whose value is a unique
49 string identifier for the resource. It can be assumed that this key is unique
50 for the resource and that information represented by this hash is all that is
51 know for the resource associated with the identifier. The store should
52 replace all existing data on this resource with the information in the
53 hash. The hash also contains another key 'TIMESTAMP' which represents the
54 local time at which this information was extracted as seconds since epoch.
55 It is illegal for either the 'ID' key or the 'TIMESTAMP' key to be absent
56 or undefined.
57  
58 Other keys in the hash are usually generated by Miners. These keys are
59 prefixed by the name space of the Miner module. For example the
60 FileMetadata::Miner::Stat miner would insert the key
61 'FileMetadata::Miner::Stat::atime'.
62  
63 There might be other keys in the hash that do not follow this convention.
64 These keys would have been generated by the application that is using the
65 Store to specify some application specific meta information.
66  
67 All values in the hash are numbers or strings.
68  
69 =head2 clear
70  
71 This method deletes all information from the store.
72  
73 This method does not return anything.
74  
75 This method does not take any arguments.
76  
77 =head2 remove
78  
79 This method is called to remove information pertaining to a certain
80 identifier in the store.
81  
82 This method does not return anything.
83  
84 This method takes a single argument which is the identifier for a resource.
85 When this method is called, all data in the store associated with the
86 specified 'ID' must be discarded.
87  
88 =head2 has
89  
90 This method takes a single argument which is the identifier for a resource.
91  
92 This method returns the time (as seconds since epoch) when the information
93 associated with the given identifier was stored. Returns undef if the
94 identifier is not known.
95  
96 =cut
97  
98 =head2 list
99  
100 This method returns a list of all identifiers that are known to the store.
101  
102 This method does not take any arguments.
103  
104 =head1 ERROR HANDLING
105  
106 Errors that occur in stores are unrecoverable by the application. It is
107 hence expected that the store should 'die' when errors occur.
108  
109 =head1 VERSION
110  
111 1.0 - This is the first release
112  
113 =head1 AUTHOR
114  
115 Midh Mulpuri midh@enjine.com
116  
117 =head1 LICENSE
118  
119 This software can be used under the terms of any Open Source Initiative
120 approved license. A list of these licenses are available at the OSI site -
121 http://www.opensource.org/licenses/
122  
123 =cut