1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is nsICacheVisitor.idl, released
17 * February 23, 2001.
18 *
19 * The Initial Developer of the Original Code is
20 * Netscape Communications Corporation.
21 * Portions created by the Initial Developer are Copyright (C) 2001
22 * the Initial Developer. All Rights Reserved.
23 *
24 * Contributor(s):
25 * Gordon Sheridan <gordon@netscape.com>
26 * Patrick Beard <beard@netscape.com>
27 * Darin Fisher <darin@netscape.com>
28 *
29 * Alternatively, the contents of this file may be used under the terms of
30 * either the GNU General Public License Version 2 or later (the "GPL"), or
31 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
32 * in which case the provisions of the GPL or the LGPL are applicable instead
33 * of those above. If you wish to allow use of your version of this file only
34 * under the terms of either the GPL or the LGPL, and not to allow others to
35 * use your version of this file under the terms of the MPL, indicate your
36 * decision by deleting the provisions above and replace them with the notice
37 * and other provisions required by the GPL or the LGPL. If you do not delete
38 * the provisions above, a recipient may use your version of this file under
39 * the terms of any one of the MPL, the GPL or the LGPL.
40 *
41 * ***** END LICENSE BLOCK ***** */
42
43 #include "nsISupports.idl"
44
45 /* XXX we should define device and entry info as well (stats, etc) */
46
47 interface nsICacheDeviceInfo;
48 interface nsICacheEntryInfo;
49
50
51 [scriptable, uuid(f8c08c4b-d778-49d1-a59b-866fdc500d95)]
52 interface nsICacheVisitor : nsISupports
53 {
54 /**
55 * Called to provide information about a cache device.
56 *
57 * @param deviceID - specifies the device being visited.
58 * @param deviceInfo - specifies information about this device.
59 *
60 * @return true to start visiting all entries for this device.
61 * @return false to advance to the next device.
62 */
63 boolean visitDevice(in string deviceID,
64 in nsICacheDeviceInfo deviceInfo);
65
66 /**
67 * Called to provide information about a cache entry.
68 *
69 * @param deviceID - specifies the device being visited.
70 * @param entryInfo - specifies information about this entry.
71 *
72 * @return true to visit the next entry on the current device, or if the
73 * end of the device has been reached, advance to the next device.
74 * @return false to advance to the next device.
75 */
76 boolean visitEntry(in string deviceID,
77 in nsICacheEntryInfo entryInfo);
78 };
79
80
81 [scriptable, uuid(31d1c294-1dd2-11b2-be3a-c79230dca297)]
82 interface nsICacheDeviceInfo : nsISupports
83 {
84 /**
85 * Get a human readable description of the cache device.
86 */
87 readonly attribute string description;
88
89 /**
90 * Get a usage report, statistics, miscellaneous data about
91 * the cache device.
92 */
93 readonly attribute string usageReport;
94
95 /**
96 * Get the number of stored cache entries.
97 */
98 readonly attribute unsigned long entryCount;
99
100 /**
101 * Get the total size of the stored cache entries.
102 */
103 readonly attribute unsigned long totalSize;
104
105 /**
106 * Get the upper limit of the size of the data the cache can store.
107 */
108 readonly attribute unsigned long maximumSize;
109 };
110
111
112 [scriptable, uuid(fab51c92-95c3-4468-b317-7de4d7588254)]
113 interface nsICacheEntryInfo : nsISupports
114 {
115 /**
116 * Get the client id associated with this cache entry.
117 */
118 readonly attribute string clientID;
119
120 /**
121 * Get the id for the device that stores this cache entry.
122 */
123 readonly attribute string deviceID;
124
125 /**
126 * Get the key identifying the cache entry.
127 */
128 readonly attribute ACString key;
129
130 /**
131 * Get the number of times the cache entry has been opened.
132 */
133 readonly attribute long fetchCount;
134
135 /**
136 * Get the last time the cache entry was opened (in seconds since the Epoch).
137 */
138 readonly attribute PRUint32 lastFetched;
139
140 /**
141 * Get the last time the cache entry was modified (in seconds since the Epoch).
142 */
143 readonly attribute PRUint32 lastModified;
144
145 /**
146 * Get the expiration time of the cache entry (in seconds since the Epoch).
147 */
148 readonly attribute PRUint32 expirationTime;
149
150 /**
151 * Get the cache entry data size.
152 */
153 readonly attribute unsigned long dataSize;
154
155 /**
156 * Find out whether or not the cache entry is stream based.
157 */
158 boolean isStreamBased();
159 };