2001-03-10 06:51:59 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-03-10 06:51:59 +03:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef _nsDiskCache_h_
|
|
|
|
#define _nsDiskCache_h_
|
|
|
|
|
2001-05-19 03:24:09 +04:00
|
|
|
#include "nsCacheEntry.h"
|
2001-03-10 06:51:59 +03:00
|
|
|
|
2005-10-08 05:20:36 +04:00
|
|
|
#ifdef XP_WIN
|
|
|
|
#include <winsock.h> // for htonl/ntohl
|
|
|
|
#endif
|
|
|
|
|
2001-03-10 06:51:59 +03:00
|
|
|
|
2001-05-19 03:24:09 +04:00
|
|
|
class nsDiskCache {
|
2001-03-10 06:51:59 +03:00
|
|
|
public:
|
2001-05-19 03:24:09 +04:00
|
|
|
enum {
|
2011-01-18 17:12:10 +03:00
|
|
|
kCurrentVersion = 0x00010013 // format = 16 bits major version/16 bits minor version
|
2001-05-19 03:24:09 +04:00
|
|
|
};
|
2001-03-10 06:51:59 +03:00
|
|
|
|
2001-05-19 03:24:09 +04:00
|
|
|
enum { kData, kMetaData };
|
2001-03-10 06:51:59 +03:00
|
|
|
|
2009-03-27 20:58:06 +03:00
|
|
|
// Parameter initval initializes internal state of hash function. Hash values are different
|
|
|
|
// for the same text when different initval is used. It can be any random number.
|
|
|
|
//
|
|
|
|
// It can be used for generating 64-bit hash value:
|
|
|
|
// (PRUint64(Hash(key, initval1)) << 32) | Hash(key, initval2)
|
|
|
|
//
|
|
|
|
// It can be also used to hash multiple strings:
|
|
|
|
// h = Hash(string1, 0);
|
|
|
|
// h = Hash(string2, h);
|
|
|
|
// ...
|
|
|
|
static PLDHashNumber Hash(const char* key, PLDHashNumber initval=0);
|
2002-08-07 05:13:29 +04:00
|
|
|
static nsresult Truncate(PRFileDesc * fd, PRUint32 newEOF);
|
2001-03-10 06:51:59 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _nsDiskCache_h_
|