Bumping manifests a=b2g-bump
[gecko.git] / netwerk / cache / nsICacheSession.idl
blobe2a4dec5bd7aa0e6e52ac185844e6c9df6f3d289
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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/. */
7 #include "nsISupports.idl"
8 #include "nsICache.idl"
10 interface nsICacheEntryDescriptor;
11 interface nsICacheListener;
12 interface nsIFile;
14 [scriptable, uuid(1dd7708c-de48-4ffe-b5aa-cd218c762887)]
15 interface nsICacheSession : nsISupports
17 /**
18 * Expired entries will be doomed or evicted if this attribute is set to
19 * true. If false, expired entries will be returned (useful for offline-
20 * mode and clients, such as HTTP, that can update the valid lifetime of
21 * cached content). This attribute defaults to true.
23 attribute boolean doomEntriesIfExpired;
25 /**
26 * When set, entries created with this session will be placed to a cache
27 * based at this directory. Use when storing entries to a different
28 * profile than the active profile of the the current running application
29 * process.
31 attribute nsIFile profileDirectory;
33 /**
34 * A cache session can only give out one descriptor with WRITE access
35 * to a given cache entry at a time. Until the client calls MarkValid on
36 * its descriptor, other attempts to open the same cache entry will block.
39 /**
40 * Synchronous cache access. This method fails if it is called on the main
41 * thread. Use asyncOpenCacheEntry() instead. This returns a unique
42 * descriptor each time it is called, even if the same key is specified.
43 * When called by multiple threads for write access, only one writable
44 * descriptor will be granted. If 'blockingMode' is set to false, it will
45 * return NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than block when another
46 * descriptor has been given WRITE access but hasn't validated the entry yet.
48 nsICacheEntryDescriptor openCacheEntry(in ACString key,
49 in nsCacheAccessMode accessRequested,
50 in boolean blockingMode);
52 /**
53 * Asynchronous cache access. Does not block the calling thread. Instead,
54 * the listener will be notified when the descriptor is available. If
55 * 'noWait' is set to true, the listener will be notified immediately with
56 * status NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than queuing the request
57 * when another descriptor has been given WRITE access but hasn't validated
58 * the entry yet.
60 void asyncOpenCacheEntry(in ACString key,
61 in nsCacheAccessMode accessRequested,
62 in nsICacheListener listener,
63 [optional] in boolean noWait);
65 /**
66 * Evict all entries for this session's clientID according to its storagePolicy.
68 void evictEntries();
70 /**
71 * Return whether any of the cache devices implied by the session storage policy
72 * are currently enabled for instantiation if they don't already exist.
74 boolean isStorageEnabled();
76 /**
77 * Asynchronously doom an entry specified by the key. Listener will be
78 * notified about the status of the operation. Null may be passed if caller
79 * doesn't care about the result.
81 void doomEntry(in ACString key, in nsICacheListener listener);
83 /**
84 * Private entries will be doomed when the last private browsing session
85 * finishes.
87 attribute boolean isPrivate;