1
0
Fork 0

added new structs for WAL documents and edges

This commit is contained in:
Jan Steemann 2014-05-20 11:49:12 +02:00
parent 52be779997
commit 57753f84dd
2 changed files with 78 additions and 0 deletions

View File

@ -136,6 +136,44 @@ BOOST_AUTO_TEST_CASE (tst_col_header_marker) {
BOOST_CHECK_EQUAL(32, offsetof(struct TRI_col_header_marker_s, _cid));
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test sizeof TRI_wal_document_marker_t
////////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE (tst_wal_document_marker) {
size_t s = sizeof(TRI_wal_document_marker_t);
BOOST_CHECK_EQUAL(24 + 48, s); // base + own size
BOOST_CHECK_EQUAL(true, s % 8 == 0);
BOOST_CHECK_EQUAL( 0, offsetof(struct TRI_wal_document_marker_s, base));
BOOST_CHECK_EQUAL(24, offsetof(struct TRI_wal_document_marker_s, _databaseId));
BOOST_CHECK_EQUAL(32, offsetof(struct TRI_wal_document_marker_s, _collectionId));
BOOST_CHECK_EQUAL(40, offsetof(struct TRI_wal_document_marker_s, _rid));
BOOST_CHECK_EQUAL(48, offsetof(struct TRI_wal_document_marker_s, _tid));
BOOST_CHECK_EQUAL(56, offsetof(struct TRI_wal_document_marker_s, _shape));
BOOST_CHECK_EQUAL(64, offsetof(struct TRI_wal_document_marker_s, _offsetKey));
BOOST_CHECK_EQUAL(66, offsetof(struct TRI_wal_document_marker_s, _offsetLegend));
BOOST_CHECK_EQUAL(68, offsetof(struct TRI_wal_document_marker_s, _offsetJson));
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test sizeof TRI_wal_edge_marker_t
////////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE (tst_wal_edge_marker) {
size_t s = sizeof(TRI_wal_edge_marker_t);
BOOST_CHECK_EQUAL(24 + 48 + 24, s); // base + own size
BOOST_CHECK_EQUAL(true, s % 8 == 0);
BOOST_CHECK_EQUAL( 0, offsetof(struct TRI_wal_edge_marker_s, base));
BOOST_CHECK_EQUAL(72, offsetof(struct TRI_wal_edge_marker_s, _toCid));
BOOST_CHECK_EQUAL(80, offsetof(struct TRI_wal_edge_marker_s, _fromCid));
BOOST_CHECK_EQUAL(88, offsetof(struct TRI_wal_edge_marker_s, _offsetToKey));
BOOST_CHECK_EQUAL(90, offsetof(struct TRI_wal_edge_marker_s, _offsetFromKey));
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test sizeof TRI_doc_document_key_marker_t
////////////////////////////////////////////////////////////////////////////////

View File

@ -343,6 +343,46 @@ typedef struct TRI_primary_collection_s {
}
TRI_primary_collection_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief wal document marker
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_wal_document_marker_s {
TRI_df_marker_t base;
TRI_voc_tick_t _databaseId;
TRI_voc_cid_t _collectionId;
TRI_voc_rid_t _rid; // this is the tick for a create and update
TRI_voc_tid_t _tid;
TRI_shape_sid_t _shape;
uint16_t _offsetKey;
uint16_t _offsetLegend;
uint32_t _offsetJson;
}
TRI_wal_document_marker_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief wal edge marker
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_wal_edge_marker_s {
TRI_wal_document_marker_t base;
TRI_voc_cid_t _toCid;
TRI_voc_cid_t _fromCid;
uint16_t _offsetToKey;
uint16_t _offsetFromKey;
#ifdef TRI_PADDING_32
char _padding_df_marker[4];
#endif
}
TRI_wal_edge_marker_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief document datafile marker with key
////////////////////////////////////////////////////////////////////////////////