TRI_index_t* TRI_CreateCapConstraint (TRI_document_collection_t* document, TRI_idx_iid_t iid, size_t count, int64_t size) { TRI_cap_constraint_t* cap = static_cast<TRI_cap_constraint_t*>(TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_cap_constraint_t), false)); if (cap == nullptr) { return nullptr; } TRI_index_t* idx = &cap->base; TRI_InitIndex(idx, iid, TRI_IDX_TYPE_CAP_CONSTRAINT, document, false, false); TRI_InitVectorString(&idx->_fields, TRI_CORE_MEM_ZONE); idx->memory = MemoryCapConstraint; idx->json = JsonCapConstraint; idx->removeIndex = RemoveIndexCapConstraint; idx->insert = InsertCapConstraint; idx->postInsert = PostInsertCapConstraint; idx->remove = RemoveCapConstraint; cap->_count = count; cap->_size = size; InitialiseCap(cap, document); return idx; }
TRI_index_t* TRI_CreateCapConstraint (struct TRI_primary_collection_s* primary, size_t size) { TRI_cap_constraint_t* cap; TRI_index_t* idx; cap = TRI_Allocate(TRI_CORE_MEM_ZONE, sizeof(TRI_cap_constraint_t), false); idx = &cap->base; idx->typeName = TypeNameCapConstraint; TRI_InitIndex(idx, TRI_IDX_TYPE_CAP_CONSTRAINT, primary, false, true); idx->json = JsonCapConstraint; idx->removeIndex = RemoveIndexCapConstraint; idx->insert = InsertCapConstraint; idx->postInsert = PostInsertCapConstraint; idx->remove = RemoveCapConstraint; cap->_size = size; InitialiseCap(cap, primary); return idx; }