зеркало из https://github.com/mozilla/gecko-dev.git
136 строки
5.2 KiB
Plaintext
136 строки
5.2 KiB
Plaintext
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
*
|
|
* The contents of this file are subject to the Netscape Public License
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
* http://www.mozilla.org/NPL/
|
|
*
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
* for the specific language governing rights and limitations under the
|
|
* NPL.
|
|
*
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
* Communications Corporation. Portions created by Netscape are
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
* Reserved.
|
|
*/
|
|
|
|
#include "nsINetDataCacheRecord.idl"
|
|
#include "nsrootidl.idl"
|
|
|
|
interface nsIFileSpec;
|
|
interface nsIURI;
|
|
interface nsIObserver;
|
|
|
|
/**
|
|
* The nsICachedNetData interface represents a single entry in a database that
|
|
* caches data retrieved from the network. This interface is implemented by the
|
|
* cache manager on top of the low-level nsINetDataCacheRecord and
|
|
* nsINetDataCache interfaces that are implemented by the database.
|
|
*
|
|
* Each cache record may contain both content and metadata. The content may
|
|
* be, for example, GIF image data or HTML, and it is accessed through
|
|
* nsIChannel's streaming API. The opaque metadata, which may contain HTTP
|
|
* headers among other things, is stored as a byte array. Each entry in the
|
|
* cache is indexed by two different keys: a record id number and a key created
|
|
* by combining the URI with a "secondary key", e.g. HTTP post data.
|
|
*
|
|
* @See nsINetDataCacheRecord
|
|
* @See nsINetDataCache
|
|
* @See nsINetDataDiskCache
|
|
* @See nsINetDataCacheManager
|
|
*/
|
|
[scriptable, uuid(6aeb2a40-6d43-11d3-90c8-000064657374)]
|
|
interface nsICachedNetData : nsINetDataCacheRecord
|
|
{
|
|
/**
|
|
* The URI that was provided as an argument to the call to
|
|
* nsINetDataCacheManager::GetCachedNetData() that created this record.
|
|
*/
|
|
readonly attribute nsIURI uri;
|
|
|
|
/**
|
|
* Getter for the opaque secondary database key that was provided as an
|
|
* argument to the call to nsINetDataCacheManager::GetCachedNetData() that
|
|
* created this record.
|
|
*/
|
|
void getSecondaryKey(out unsigned long length,
|
|
[retval, size_is(length)] out string secondaryKey);
|
|
|
|
/**
|
|
* This flag may be set by a protocol handler to indicate that it supports
|
|
* partial fetching of data. In that case, the cache manager may truncate
|
|
* the entry's content to accommodate data for other cache entries rather
|
|
* than deleting it wholesale.
|
|
*/
|
|
attribute boolean allowPartial;
|
|
|
|
/**
|
|
* This flag indicates that the write stream supplying content data for the
|
|
* cache did not complete normally, so the content may be truncated.
|
|
*/
|
|
readonly attribute boolean partial;
|
|
|
|
/**
|
|
* This flag can be set and cleared by a protocol handler so as to avoid
|
|
* race conditions in which the handler issues two identical network
|
|
* requests to fill the same cache entry.
|
|
*/
|
|
attribute boolean updateInProgress;
|
|
|
|
/**
|
|
* Date/time that the document was last stored on the origin server, as
|
|
* supplied by the protocol handler. If the protocol can't supply a
|
|
* last-modified time, this attribute should remain unset. This value
|
|
* is used as input to the cache replacement policy.
|
|
*
|
|
* FIXME: Should use nsIDateTime interface, once it's created
|
|
* instead of PRTime, for improved scriptability ?
|
|
*/
|
|
readonly attribute PRTime lastModifiedTime;
|
|
|
|
/**
|
|
* Date/time of expiration for this record, supplied by the protocol
|
|
* handler, at which point the content is *likely* to be stale. This
|
|
* heuristic date does not necessarily correspond to the HTTP Expires
|
|
* header, as it does not determine when cached network data must be
|
|
* validated with the origin server, but only serves as a hint to the cache
|
|
* replacement policy.
|
|
*/
|
|
readonly attribute PRTime expirationTime;
|
|
|
|
/**
|
|
* Date/time of last access (retrieval) of the data in this record.
|
|
*/
|
|
readonly attribute PRTime lastRetrievalTime;
|
|
|
|
/**
|
|
* Number of times an output stream has been created for this cache entry
|
|
* since it was first stored.
|
|
*/
|
|
readonly attribute PRUint16 numberRetrievals;
|
|
|
|
/**
|
|
* If the underlying cache database is persistent, flush this entry's data
|
|
* to the database and the underlying nsINetDataCacheRecord instance.
|
|
*/
|
|
void commit();
|
|
|
|
/**
|
|
* Add an observer for this cache record. When the cache wants to delete
|
|
* or truncate a record, so as to make space for another cache entry's
|
|
* content data, it will call <code>aObserver</code>'s Observe() method,
|
|
* passing the nsICachedNetData instance as the <code>aSubject</code>
|
|
* argument and "Eviction Notice" as the <code>aTopic</code> argument. If
|
|
* the observer does not wish to inhibit the deletion, it should Release()
|
|
* any references it has to the cache record.
|
|
*/
|
|
void addObserver(in nsIObserver aObserver);
|
|
|
|
/**
|
|
* Delete an observer that was added by the AddObserver() method.
|
|
*/
|
|
void removeObserver(in nsIObserver aObserver);
|
|
};
|