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