#include <node_file.h>
Public Member Functions | |
void | addUser () |
unsigned | cacheSize () const |
void | clearChildFile (uint8_t child) |
Node * | createNode (const ShortId &short_id) |
void | deserialize () |
void | deserialize (const ByteVec &buffer) |
NodeState | getNodeState () |
boost::filesystem::path | getPath () const |
bool | hasChildFile (uint8_t child) const |
void | initializeFromChildren (const boost::filesystem::path &_path, std::vector< boost::shared_ptr< NodeFile > > &children) |
void | initializeRootNodeFile (const boost::filesystem::path &_path, NodeFile &child) |
bool | isModified () |
NodeFile (const boost::filesystem::path &_path, boost::shared_ptr< NodeAllocator > _node_allocator=boost::shared_ptr< NodeAllocator >(), boost::shared_ptr< PairAllocator > _pair_allocator=boost::shared_ptr< PairAllocator >()) | |
Node * | readNode (const ShortId &short_id) |
void | releaseNode (Node *node, const ShortId &short_id, bool modified) |
void | removeUser () |
void | serialize (ByteVec &buffer) |
void | serializeBytesize (ByteVec &buffer) |
void | setChildFile (uint8_t child) |
void | setNodeState (NodeState state) |
void | setWritten () |
unsigned | users () const |
void | waitUntilLoaded () |
~NodeFile () | |
Public Attributes | |
boost::mutex | mutex |
Private Types | |
typedef Allocator< Node > | NodeAllocator |
typedef std::map< ShortId, Node * > | NodeCache |
typedef Allocator< std::pair < ShortId, Node * > > | PairAllocator |
Static Private Member Functions | |
static void | deserializeNode (Node *node, ShortId &short_id, const ByteVec &buffer, unsigned &offse) |
static void | serializeNode (const Node *node, const ShortId &short_id, ByteVec &buffer, unsigned &offset) |
Private Attributes | |
uint8_t | child_files |
bool | is_modified |
boost::shared_ptr< NodeAllocator > | node_allocator |
std::map< ShortId, Node *, std::less< ShortId > > | node_cache |
NodeState | node_state |
Cond | node_state_condition |
SpinLock | node_state_mutex |
boost::shared_ptr< PairAllocator > | pair_allocator |
boost::filesystem::path | path |
size_t | use_count |
Definition at line 110 of file node_file.h.
typedef Allocator<Node> megatree::NodeFile::NodeAllocator [private] |
Definition at line 112 of file node_file.h.
typedef std::map<ShortId, Node*> megatree::NodeFile::NodeCache [private] |
Definition at line 241 of file node_file.h.
typedef Allocator<std::pair<ShortId, Node*> > megatree::NodeFile::PairAllocator [private] |
Definition at line 113 of file node_file.h.
megatree::NodeFile::NodeFile | ( | const boost::filesystem::path & | _path, |
boost::shared_ptr< NodeAllocator > | _node_allocator = boost::shared_ptr<NodeAllocator>() , |
||
boost::shared_ptr< PairAllocator > | _pair_allocator = boost::shared_ptr<PairAllocator>() |
||
) | [inline] |
Definition at line 116 of file node_file.h.
Definition at line 145 of file node_file.cpp.
void megatree::NodeFile::addUser | ( | ) | [inline] |
Definition at line 181 of file node_file.h.
unsigned megatree::NodeFile::cacheSize | ( | ) | const [inline] |
Definition at line 195 of file node_file.h.
void megatree::NodeFile::clearChildFile | ( | uint8_t | child | ) | [inline] |
Definition at line 174 of file node_file.h.
Node * megatree::NodeFile::createNode | ( | const ShortId & | short_id | ) |
Definition at line 341 of file node_file.cpp.
void megatree::NodeFile::deserialize | ( | ) |
Definition at line 10 of file node_file.cpp.
void megatree::NodeFile::deserialize | ( | const ByteVec & | buffer | ) |
Definition at line 21 of file node_file.cpp.
void megatree::NodeFile::deserializeNode | ( | Node * | node, |
ShortId & | short_id, | ||
const ByteVec & | buffer, | ||
unsigned & | offse | ||
) | [static, private] |
Definition at line 385 of file node_file.cpp.
NodeState megatree::NodeFile::getNodeState | ( | ) | [inline] |
Definition at line 205 of file node_file.h.
boost::filesystem::path megatree::NodeFile::getPath | ( | ) | const [inline] |
Definition at line 193 of file node_file.h.
bool megatree::NodeFile::hasChildFile | ( | uint8_t | child | ) | const [inline] |
Definition at line 163 of file node_file.h.
void megatree::NodeFile::initializeFromChildren | ( | const boost::filesystem::path & | _path, |
std::vector< boost::shared_ptr< NodeFile > > & | children | ||
) |
Definition at line 218 of file node_file.cpp.
void megatree::NodeFile::initializeRootNodeFile | ( | const boost::filesystem::path & | _path, |
NodeFile & | child | ||
) |
Definition at line 274 of file node_file.cpp.
bool megatree::NodeFile::isModified | ( | ) | [inline] |
Definition at line 200 of file node_file.h.
Node * megatree::NodeFile::readNode | ( | const ShortId & | short_id | ) |
Definition at line 179 of file node_file.cpp.
void megatree::NodeFile::releaseNode | ( | Node * | node, |
const ShortId & | short_id, | ||
bool | modified | ||
) |
Definition at line 357 of file node_file.cpp.
void megatree::NodeFile::removeUser | ( | ) | [inline] |
Definition at line 187 of file node_file.h.
void megatree::NodeFile::serialize | ( | ByteVec & | buffer | ) |
Definition at line 62 of file node_file.cpp.
void megatree::NodeFile::serializeBytesize | ( | ByteVec & | buffer | ) |
Definition at line 78 of file node_file.cpp.
void megatree::NodeFile::serializeNode | ( | const Node * | node, |
const ShortId & | short_id, | ||
ByteVec & | buffer, | ||
unsigned & | offset | ||
) | [static, private] |
Definition at line 369 of file node_file.cpp.
void megatree::NodeFile::setChildFile | ( | uint8_t | child | ) | [inline] |
Definition at line 168 of file node_file.h.
void megatree::NodeFile::setNodeState | ( | NodeState | state | ) |
Definition at line 138 of file node_file.cpp.
void megatree::NodeFile::setWritten | ( | ) | [inline] |
Definition at line 152 of file node_file.h.
unsigned megatree::NodeFile::users | ( | ) | const [inline] |
Definition at line 158 of file node_file.h.
void megatree::NodeFile::waitUntilLoaded | ( | ) |
Definition at line 121 of file node_file.cpp.
uint8_t megatree::NodeFile::child_files [private] |
Definition at line 227 of file node_file.h.
bool megatree::NodeFile::is_modified [private] |
Definition at line 252 of file node_file.h.
boost::mutex megatree::NodeFile::mutex |
Definition at line 215 of file node_file.h.
boost::shared_ptr<NodeAllocator> megatree::NodeFile::node_allocator [private] |
Definition at line 248 of file node_file.h.
std::map<ShortId, Node*, std::less<ShortId> > megatree::NodeFile::node_cache [private] |
Definition at line 243 of file node_file.h.
NodeState megatree::NodeFile::node_state [private] |
Definition at line 222 of file node_file.h.
Cond megatree::NodeFile::node_state_condition [private] |
Definition at line 221 of file node_file.h.
SpinLock megatree::NodeFile::node_state_mutex [private] |
Definition at line 219 of file node_file.h.
boost::shared_ptr<PairAllocator> megatree::NodeFile::pair_allocator [private] |
Definition at line 249 of file node_file.h.
boost::filesystem::path megatree::NodeFile::path [private] |
Definition at line 224 of file node_file.h.
size_t megatree::NodeFile::use_count [private] |
Definition at line 251 of file node_file.h.