netwerk/cache/nsICacheSession.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/cache/nsICacheSession.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,88 @@
     1.4 +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "nsISupports.idl"
    1.11 +#include "nsICache.idl"
    1.12 +
    1.13 +interface nsICacheEntryDescriptor;
    1.14 +interface nsICacheListener;
    1.15 +interface nsIFile;
    1.16 +
    1.17 +[scriptable, uuid(1dd7708c-de48-4ffe-b5aa-cd218c762887)]
    1.18 +interface nsICacheSession : nsISupports
    1.19 +{
    1.20 +    /**
    1.21 +     * Expired entries will be doomed or evicted if this attribute is set to
    1.22 +     * true.  If false, expired entries will be returned (useful for offline-
    1.23 +     * mode and clients, such as HTTP, that can update the valid lifetime of
    1.24 +     * cached content).  This attribute defaults to true.
    1.25 +     */
    1.26 +    attribute boolean doomEntriesIfExpired;
    1.27 +
    1.28 +    /**
    1.29 +     * When set, entries created with this session will be placed to a cache
    1.30 +     * based at this directory.  Use when storing entries to a different
    1.31 +     * profile than the active profile of the the current running application
    1.32 +     * process.
    1.33 +     */
    1.34 +    attribute nsIFile profileDirectory;
    1.35 +
    1.36 +    /**
    1.37 +     * A cache session can only give out one descriptor with WRITE access
    1.38 +     * to a given cache entry at a time.  Until the client calls MarkValid on
    1.39 +     * its descriptor, other attempts to open the same cache entry will block.
    1.40 +     */
    1.41 +
    1.42 +    /**
    1.43 +     * Synchronous cache access. This method fails if it is called on the main
    1.44 +     * thread. Use asyncOpenCacheEntry() instead. This returns a unique
    1.45 +     * descriptor each time it is called, even if the same key is specified.
    1.46 +     * When called by multiple threads for write access, only one writable
    1.47 +     * descriptor will be granted.  If 'blockingMode' is set to false, it will
    1.48 +     * return NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than block when another
    1.49 +     * descriptor has been given WRITE access but hasn't validated the entry yet.
    1.50 +     */
    1.51 +    nsICacheEntryDescriptor openCacheEntry(in ACString          key,
    1.52 +                                           in nsCacheAccessMode accessRequested,
    1.53 +                                           in boolean           blockingMode);
    1.54 +
    1.55 +    /**
    1.56 +     * Asynchronous cache access. Does not block the calling thread. Instead,
    1.57 +     * the listener will be notified when the descriptor is available. If
    1.58 +     * 'noWait' is set to true, the listener will be notified immediately with
    1.59 +     * status NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than queuing the request
    1.60 +     * when another descriptor has been given WRITE access but hasn't validated
    1.61 +     * the entry yet.
    1.62 +     */
    1.63 +    void asyncOpenCacheEntry(in ACString           key,
    1.64 +                             in nsCacheAccessMode  accessRequested,
    1.65 +                             in nsICacheListener   listener,
    1.66 +                             [optional] in boolean noWait);
    1.67 +
    1.68 +    /**
    1.69 +     * Evict all entries for this session's clientID according to its storagePolicy.
    1.70 +     */
    1.71 +    void evictEntries();
    1.72 +    
    1.73 +    /**
    1.74 +     * Return whether any of the cache devices implied by the session storage policy
    1.75 +     * are currently enabled for instantiation if they don't already exist.
    1.76 +     */
    1.77 +    boolean isStorageEnabled();
    1.78 +
    1.79 +    /**
    1.80 +     * Asynchronously doom an entry specified by the key. Listener will be
    1.81 +     * notified about the status of the operation. Null may be passed if caller
    1.82 +     * doesn't care about the result.
    1.83 +     */
    1.84 +    void doomEntry(in ACString key, in nsICacheListener listener);
    1.85 +
    1.86 +    /**
    1.87 +     * Private entries will be doomed when the last private browsing session
    1.88 +     * finishes.
    1.89 +     */
    1.90 +    attribute boolean isPrivate;
    1.91 +};

mercurial