1/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7#include "nsISupports.idl"
8
9/* XXX we should define device and entry info as well (stats, etc) */
10
11interface nsICacheDeviceInfo;
12interface nsICacheEntryInfo;
13
14
15[scriptable, uuid(f8c08c4b-d778-49d1-a59b-866fdc500d95)]
16interface nsICacheVisitor : nsISupports
17{
18    /**
19     * Called to provide information about a cache device.
20     *
21     * @param deviceID - specifies the device being visited.
22     * @param deviceInfo - specifies information about this device.
23     *
24     * @return true to start visiting all entries for this device.
25     * @return false to advance to the next device.
26     */
27    boolean visitDevice(in string               deviceID,
28                        in nsICacheDeviceInfo   deviceInfo);
29
30    /**
31     * Called to provide information about a cache entry.
32     *
33     * @param deviceID - specifies the device being visited.
34     * @param entryInfo - specifies information about this entry.
35     *
36     * @return true to visit the next entry on the current device, or if the
37     *   end of the device has been reached, advance to the next device.
38     * @return false to advance to the next device.
39     */
40    boolean visitEntry(in string                deviceID,
41                       in nsICacheEntryInfo     entryInfo);
42};
43
44
45[scriptable, uuid(31d1c294-1dd2-11b2-be3a-c79230dca297)]
46interface nsICacheDeviceInfo : nsISupports
47{
48    /**
49     * Get a human readable description of the cache device.
50     */
51    readonly attribute ACString  description;
52
53    /**
54     * Get a usage report, statistics, miscellaneous data about
55     * the cache device.
56     */
57    readonly attribute ACString  usageReport;
58
59    /**
60     * Get the number of stored cache entries.
61     */
62    readonly attribute unsigned long  entryCount;
63
64    /**
65     * Get the total size of the stored cache entries.
66     */
67    readonly attribute unsigned long  totalSize;
68
69    /**
70     * Get the upper limit of the size of the data the cache can store.
71     */
72    readonly attribute unsigned long  maximumSize;
73};
74
75
76[scriptable, uuid(fab51c92-95c3-4468-b317-7de4d7588254)]
77interface nsICacheEntryInfo : nsISupports
78{
79    /**
80     * Get the client id associated with this cache entry.
81     */
82    readonly attribute ACString clientID;
83
84    /**
85     * Get the id for the device that stores this cache entry.
86     */
87    readonly attribute ACString deviceID;
88
89    /**
90     * Get the key identifying the cache entry.
91     */
92    readonly attribute ACString key;
93
94    /**
95     * Get the number of times the cache entry has been opened.
96     */
97    readonly attribute long  fetchCount;
98
99    /**
100     * Get the last time the cache entry was opened (in seconds since the Epoch).
101     */
102    readonly attribute uint32_t  lastFetched;
103
104    /**
105     * Get the last time the cache entry was modified (in seconds since the Epoch).
106     */
107    readonly attribute uint32_t  lastModified;
108
109    /**
110     * Get the expiration time of the cache entry (in seconds since the Epoch).
111     */
112    readonly attribute uint32_t  expirationTime;
113
114    /**
115     * Get the cache entry data size.
116     */
117    readonly attribute unsigned long  dataSize;
118
119    /**
120     * Find out whether or not the cache entry is stream based.
121     */
122    boolean  isStreamBased();
123};
124