1 /* 2 * Copyright 2001-2010, Haiku Inc. All rights reserved. 3 * This file may be used under the terms of the MIT License. 4 * 5 * Authors: 6 * Janito V. Ferreira Filho 7 */ 8 #ifndef HASHREVOKEMANAGER_H 9 #define HASHREVOKEMANAGER_H 10 11 #include <util/khash.h> 12 13 #include "RevokeManager.h" 14 15 16 struct RevokeElement { 17 RevokeElement* next; // Next in hash 18 uint32 block; 19 uint32 commitID; 20 }; 21 22 23 class HashRevokeManager : public RevokeManager { 24 public: 25 HashRevokeManager(); 26 virtual ~HashRevokeManager(); 27 28 status_t Init(); 29 30 virtual status_t Insert(uint32 block, uint32 commitID); 31 virtual status_t Remove(uint32 block); 32 virtual bool Lookup(uint32 block, uint32 commitID); 33 34 static int Compare(void* element, const void* key); 35 static uint32 Hash(void* element, const void* key, uint32 range); 36 37 protected: 38 status_t _ForceInsert(uint32 block, uint32 commitID); 39 40 private: 41 hash_table* fHash; 42 43 const int kInitialHashSize; 44 }; 45 46 #endif // HASHREVOKEMANAGER_H 47 48