2001-02-23 00:11:10 +00:00
|
|
|
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is nsICacheEntryDescriptor.idl, released
|
|
|
|
* February 10, 2001.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 2001 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2001-02-23 23:20:15 +00:00
|
|
|
* Gordon Sheridan <gordon@netscape.com>
|
|
|
|
* Patrick Beard <beard@netscape.com>
|
|
|
|
* Darin Fisher <darin@netscape.com>
|
2001-02-23 00:11:10 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsITransport.idl"
|
2001-02-23 23:20:15 +00:00
|
|
|
#include "nsICache.idl"
|
2001-02-23 00:11:10 +00:00
|
|
|
|
|
|
|
interface nsISimpleEnumerator;
|
|
|
|
interface nsICacheListener;
|
2001-03-07 01:37:42 +00:00
|
|
|
interface nsIFile;
|
2001-02-23 00:11:10 +00:00
|
|
|
|
|
|
|
[scriptable, uuid(49c1a11d-f5d2-4f09-8262-551e64908ada)]
|
2001-02-23 23:55:42 +00:00
|
|
|
interface nsICacheEntryDescriptor : nsISupports
|
2001-02-23 00:11:10 +00:00
|
|
|
{
|
|
|
|
/**
|
2001-02-24 01:27:49 +00:00
|
|
|
* Get the key identifying the cache entry.
|
2001-02-23 00:11:10 +00:00
|
|
|
*/
|
2001-02-24 01:27:49 +00:00
|
|
|
readonly attribute string key;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the number of times the cache entry has been opened.
|
|
|
|
*/
|
|
|
|
readonly attribute long fetchCount;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the last time the cache entry was opened.
|
|
|
|
*/
|
|
|
|
readonly attribute PRTime lastFetched;
|
2001-02-23 00:11:10 +00:00
|
|
|
|
2001-03-08 05:31:52 +00:00
|
|
|
/**
|
|
|
|
* Get the last time the cache entry was modified.
|
|
|
|
*/
|
|
|
|
readonly attribute PRTime lastModified;
|
|
|
|
|
2001-02-24 01:27:49 +00:00
|
|
|
/**
|
|
|
|
* Get the last time the cache entry was marked valid.
|
|
|
|
*/
|
|
|
|
readonly attribute PRTime lastValidated;
|
2001-02-23 23:20:15 +00:00
|
|
|
|
2001-02-24 01:27:49 +00:00
|
|
|
/**
|
|
|
|
* Get the expiration time of the cache entry.
|
|
|
|
*/
|
|
|
|
attribute PRTime expirationTime;
|
2001-02-23 23:55:42 +00:00
|
|
|
|
2001-02-24 01:27:49 +00:00
|
|
|
/**
|
|
|
|
* Find out whether or not the cache entry is stream based.
|
|
|
|
*/
|
|
|
|
boolean isStreamBased();
|
2001-02-23 23:55:42 +00:00
|
|
|
|
2001-02-23 23:20:15 +00:00
|
|
|
/**
|
2001-02-24 01:27:49 +00:00
|
|
|
* Get/set the cache entry data size. This attribute can only be set if
|
|
|
|
* the cache entry IS NOT stream based.
|
2001-02-23 23:20:15 +00:00
|
|
|
*/
|
2001-02-24 01:27:49 +00:00
|
|
|
attribute unsigned long dataSize;
|
2001-02-23 00:11:10 +00:00
|
|
|
|
|
|
|
/**
|
2001-02-24 01:27:49 +00:00
|
|
|
* Get a transport to the cache data. This will fail if the cache entry
|
|
|
|
* IS NOT stream based.
|
2001-02-23 23:55:42 +00:00
|
|
|
*/
|
2001-02-24 01:27:49 +00:00
|
|
|
readonly attribute nsITransport transport;
|
2001-02-23 23:55:42 +00:00
|
|
|
|
|
|
|
/**
|
2001-02-24 01:27:49 +00:00
|
|
|
* Get/set the cache data element. This will fail if the cache entry
|
|
|
|
* IS stream based. The cache entry holds a strong reference to this
|
|
|
|
* object. The object will be released when the cache entry is destroyed.
|
2001-02-23 00:11:10 +00:00
|
|
|
*/
|
2001-02-24 01:27:49 +00:00
|
|
|
attribute nsISupports cacheElement;
|
2001-02-23 23:20:15 +00:00
|
|
|
|
2001-02-23 00:11:10 +00:00
|
|
|
/**
|
2001-02-24 01:27:49 +00:00
|
|
|
* Get the access granted to this descriptor. See nsICache.idl for the
|
|
|
|
* definitions of the access modes and a thorough description of their
|
|
|
|
* corresponding meanings.
|
2001-02-23 00:11:10 +00:00
|
|
|
*/
|
2001-02-24 01:27:49 +00:00
|
|
|
readonly attribute nsCacheAccessMode accessGranted;
|
2001-02-23 00:11:10 +00:00
|
|
|
|
|
|
|
/**
|
2001-02-24 01:27:49 +00:00
|
|
|
* Get/set the storage policy of the cache entry. See nsICache.idl for
|
|
|
|
* the definitions of the storage policies.
|
2001-02-23 00:11:10 +00:00
|
|
|
*/
|
2001-02-23 23:20:15 +00:00
|
|
|
attribute nsCacheStoragePolicy storagePolicy;
|
2001-03-07 01:37:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the disk file associated with the cache entry.
|
|
|
|
*/
|
|
|
|
readonly attribute nsIFile file;
|
2001-03-07 02:47:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get/set security info on the cache entry for this descriptor. This fails
|
|
|
|
* if the storage policy is not STORE_IN_MEMORY.
|
|
|
|
*/
|
|
|
|
attribute nsISupports securityInfo;
|
2001-02-23 00:11:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Doom the cache entry this descriptor references in order to slate it for
|
|
|
|
* removal. Once doomed a cache entry cannot be undoomed.
|
2001-02-24 01:27:49 +00:00
|
|
|
*
|
|
|
|
* A descriptor with WRITE access can doom the cache entry and choose to
|
|
|
|
* fail pending requests. This means that pending requests will not get
|
|
|
|
* a cache descriptor. This is meant as a tool for clients that wish to
|
|
|
|
* instruct pending requests to skip the cache.
|
2001-02-23 00:11:10 +00:00
|
|
|
*/
|
|
|
|
void doom();
|
|
|
|
void doomAndFailPendingRequests(in nsresult status);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A writer must validate this cache object before any readers are given
|
|
|
|
* a descriptor to the object.
|
|
|
|
*/
|
|
|
|
void markValid();
|
2001-02-27 05:29:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Explicitly close the descriptor (optional).
|
|
|
|
*/
|
2001-02-23 00:11:10 +00:00
|
|
|
|
2001-02-27 05:29:25 +00:00
|
|
|
void close();
|
|
|
|
|
2001-02-23 00:11:10 +00:00
|
|
|
/**
|
2001-02-24 01:27:49 +00:00
|
|
|
* Methods for accessing meta data. Meta data is a table of key/value
|
|
|
|
* string pairs. The strings do not have to conform to any particular
|
|
|
|
* charset, but they must be null terminated.
|
2001-02-23 00:11:10 +00:00
|
|
|
*/
|
2001-02-24 01:27:49 +00:00
|
|
|
string getMetaDataElement(in string key);
|
2001-03-02 01:52:29 +00:00
|
|
|
void setMetaDataElement(in string key, in string value);
|
2001-02-23 00:11:10 +00:00
|
|
|
|
2001-02-24 01:27:49 +00:00
|
|
|
nsISimpleEnumerator getMetaDataEnumerator(); /* todo */
|
2001-02-23 00:11:10 +00:00
|
|
|
};
|
|
|
|
|