1 // 2 // Index.h 3 // CoreEntitlements 4 // 5 // 6 7 #ifndef CORE_ENTITLEMENTS_INDEX_H 8 #define CORE_ENTITLEMENTS_INDEX_H 9 10 #ifndef _CE_INDIRECT 11 #error "Please include <CoreEntitlements/CoreEntitlements.h> instead of this file" 12 #endif 13 14 #include <CoreEntitlements/Result.h> 15 16 /* 17 The kernel always supports acceleration 18 */ 19 #define CE_ACCELERATION_SUPPORTED 1 20 21 22 /*! 23 @typedef CEAccelerationElement_t 24 25 A single element of the acceleration structure, the contents of this struct are an implementation detail 26 and are subject to change. 27 */ 28 typedef struct CEAccelerationElement { 29 uint32_t key_offset; 30 uint32_t key_length; 31 } CEAccelerationElement_t; 32 33 /*! 34 @struct CEAccelerationContext 35 36 Contains data required to accelerate queries, the contents of this struct are an implementation detail 37 and are subject to change. 38 */ 39 struct CEAccelerationContext { 40 CEAccelerationElement_t * __counted_by(index_count) index; 41 size_t index_count; 42 }; 43 44 /*! 45 @function CEIndexSizeForContext 46 Computes an upper bound of memory needed to construct an acceleration index for a particular query context. 47 48 @param context 49 The context for which the calculation should be made 50 51 @param size 52 Contains the required size, in bytes. 53 54 @returns an error if the context cannot be accelerated, success otherwise 55 */ 56 CEError_t CEIndexSizeForContext(CEQueryContext_t context, size_t* size); 57 58 /*! 59 @function CEBuildIndexForContext 60 Computes and stores and acceleration index into the passed in context. 61 Building an index requires runtime support. 62 63 @param context 64 The context for which the index should be computed. 65 */ 66 CEError_t CEBuildIndexForContext(CEQueryContext_t context); 67 68 /*! 69 @function CEFreeIndexForContext 70 Frees an index associated with a query context 71 72 @param context 73 The context for which the index should be freed. 74 */ 75 CEError_t CEFreeIndexForContext(CEQueryContext_t context); 76 77 /*! 78 @function CEContextIsAccelerated 79 Checks if the passed in context supports query acceleration 80 81 @param context 82 The context to check. 83 */ 84 bool CEContextIsAccelerated(CEQueryContext_t context); 85 86 #endif /* CORE_ENTITLEMENTS_INDEX_H */ 87