#ifndef CHUNK_H_ #define CHUNK_H_ #include #include #include #include namespace db { struct Chunk { static const unsigned SAVED_PATH_SIZE = 43; EntryID id; /* 12 */ uint32_t targetID; /* 16 */ uint32_t buddyGroupID; /* 20 */ /* savedPath layout is ... weird. * we have two layouts: * - // * - u/<(ts >> 16) _b16>/<(ts >> 12) & 0xF _b16>/ * * where u16 are random 16 bit unsigneds each. that gives maximum path lengths of * - 2 + 1 + 2 + 26 * - 9 + 1 + 4 + 1 + 1 + 1 + 26 * add a terminating NUL to each, the maximum path length becomes 44 bytes, * which is also conveniently aligned for uint_64t followers */ char savedPath[SAVED_PATH_SIZE + 1]; /* 64 */ int64_t fileSize; /* 72 */ int64_t usedBlocks; /* 80 */ uint32_t uid; /* 84 */ uint32_t gid; /* 88 */ typedef boost::tuple KeyType; KeyType pkey() const { return KeyType(id, targetID, buddyGroupID); } operator FsckChunk() const { Path path(savedPath); return FsckChunk(id.str(), targetID, path, fileSize, usedBlocks, 0, 0, 0, uid, gid, buddyGroupID); } }; } #endif