gStore/KVstore/IVArray/IVEntry.h

60 lines
1.2 KiB
C
Raw Normal View History

2018-02-13 11:37:54 +08:00
/*=======================================================================
* File name: IVEntry.h
* Author: Zongyue Qin
* Mail: qinzongyue@pku.edu.cn
* Last Modified: 2018-01-30
* Description: head file of IVEntry, the most basic unit of IVArray
* =====================================================================*/
#include "../../Util/Util.h"
#include "../../Util/VList.h"
using namespace std;
class IVEntry
{
bool usedFlag; // mark if the entry is used
bool dirtyFlag;
bool cacheFlag;
bool CachePinFlag;
2018-02-13 11:37:54 +08:00
unsigned store; //index of block where value is stored
// pointer to id for LRU list
int prevID;
int nextID;
2018-02-13 11:37:54 +08:00
Bstr* value;
2018-02-13 11:37:54 +08:00
public:
IVEntry();
void setBstr(const Bstr* _value);
bool getBstr(char *& _str, unsigned& _len, bool if_copy = true) const;
2018-03-19 14:06:27 +08:00
void setBstr(char *_str, unsigned _len);
2018-02-13 11:37:54 +08:00
void setStore(unsigned _store);
unsigned getStore() const;
void setUsedFlag(bool _flag);
bool isUsed() const;
void setDirtyFlag(bool _flag);
bool isDirty() const;
void setCacheFlag(bool _flag);
bool inCache() const;
void setCachePinFlag(bool _flag);
bool isPined();
2018-02-13 11:37:54 +08:00
void release();
void Copy(const IVEntry& _entry);
void setPrev(int ID);
int getPrev() const;
void setNext(int ID);
int getNext() const;
2018-02-13 11:37:54 +08:00
~IVEntry();
};