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