int TRI_InitPrimaryCollection (TRI_primary_collection_t* primary, TRI_shaper_t* shaper) { primary->_shaper = shaper; primary->_capConstraint = NULL; primary->_keyGenerator = NULL; primary->figures = Figures; primary->size = Count; TRI_InitBarrierList(&primary->_barrierList, primary); TRI_InitAssociativePointer(&primary->_datafileInfo, TRI_UNKNOWN_MEM_ZONE, HashKeyDatafile, HashElementDatafile, IsEqualKeyElementDatafile, NULL); TRI_InitAssociativePointer(&primary->_primaryIndex, TRI_UNKNOWN_MEM_ZONE, HashKeyHeader, HashElementDocument, IsEqualKeyDocument, 0); TRI_InitReadWriteLock(&primary->_lock); return TRI_ERROR_NO_ERROR; }
int TRI_InitPrimaryCollection (TRI_primary_collection_t* primary, TRI_shaper_t* shaper) { int res; primary->_shaper = shaper; primary->_capConstraint = NULL; primary->_keyGenerator = NULL; primary->_numberDocuments = 0; primary->_lastCompaction = 0.0; primary->figures = Figures; primary->size = Count; res = TRI_InitAssociativePointer(&primary->_datafileInfo, TRI_UNKNOWN_MEM_ZONE, HashKeyDatafile, HashElementDatafile, IsEqualKeyElementDatafile, NULL); if (res != TRI_ERROR_NO_ERROR) { return res; } res = TRI_InitAssociativePointer(&primary->_primaryIndex, TRI_UNKNOWN_MEM_ZONE, HashKeyHeader, HashElementDocument, IsEqualKeyDocument, NULL); if (res != TRI_ERROR_NO_ERROR) { TRI_DestroyAssociativePointer(&primary->_datafileInfo); return res; } TRI_InitBarrierList(&primary->_barrierList, primary); TRI_InitReadWriteLock(&primary->_lock); TRI_InitReadWriteLock(&primary->_compactionLock); return TRI_ERROR_NO_ERROR; }
void TRI_InitDocCollection (TRI_doc_collection_t* collection, TRI_shaper_t* shaper) { collection->_shaper = shaper; collection->_capConstraint = NULL; collection->createLock = CreateLock; collection->createJson = CreateJson; collection->updateLock = UpdateLock; collection->updateJson = UpdateJson; collection->destroyLock = DestroyLock; collection->figures = Figures; TRI_InitBarrierList(&collection->_barrierList, collection); TRI_InitAssociativePointer(&collection->_datafileInfo, TRI_UNKNOWN_MEM_ZONE, HashKeyDatafile, HashElementDatafile, IsEqualKeyElementDatafile, NULL); }