Ejemplo n.º 1
0
 private static extern bool _c4indexer_end(C4Indexer *indexer, [MarshalAs(UnmanagedType.U1)]bool commit, C4Error *outError);
Ejemplo n.º 2
0
 /// <summary>
 /// Finishes an indexing task and frees the indexer reference.
 /// </summary>
 /// <param name="indexer">The indexer to operate on</param>
 /// <param name="commit">True to commit changes to the indexes, false to abort</param>
 /// <param name="outError">The error that occurred if the operation doesn't succeed</param>
 /// <returns>true on success, false otherwise</returns>
 public static bool c4indexer_end(C4Indexer *indexer, bool commit, C4Error *outError)
 {
     #if DEBUG
     var ptr = (IntPtr)indexer;
     #if ENABLE_LOGGING
     if(ptr != IntPtr.Zero && !_AllocatedObjects.ContainsKey(ptr)) {
         Console.WriteLine("WARNING: [c4indexer_end] freeing object 0x{0} that was not found in allocated list", ptr.ToString("X"));
     } else {
     #endif
         _AllocatedObjects.Remove(ptr);
     #if ENABLE_LOGGING
     }
     #endif
     #endif
     return _c4indexer_end(indexer, commit, outError);
 }
Ejemplo n.º 3
0
     public static bool c4indexer_emit(C4Indexer *indexer, C4Document *document, uint viewNumber,
         C4Key*[] emittedKeys, string[] emittedValues, C4Error *outError)
     {
         var c4StringArr = emittedValues.Select(x => new C4String(x)).ToArray();
         var sliceArr = c4StringArr.Select(x => x.AsC4Slice()).ToArray();
         var retVal = c4indexer_emit(indexer, document, viewNumber, emittedKeys, sliceArr, outError);
         foreach(var c4str in c4StringArr) {
             c4str.Dispose();
         }
 
         return retVal;
     }
Ejemplo n.º 4
0
 /// <summary>
 /// Emits new keys/values derived from one document, for one view.
 /// This function needs to be called once for each(document, view) pair.Even if the view's map
 /// function didn't emit anything, the old keys/values need to be cleaned up.
 ///      
 /// Values are uninterpreted by CBForest, but by convention are JSON. A special value "*"
 /// (a single asterisk) is used as a placeholder for the entire document.
 ///
 /// </summary>
 /// <param name="indexer">The indexer to operate on</param>
 /// <param name="document">The document being indexed</param>
 /// <param name="viewNumber">The position of the view in the indexer's views[] array</param>
 /// <param name="emittedKeys">Array of keys being emitted</param>
 /// <param name="emittedValues">Array of values being emitted. (JSON by convention.)</param>
 /// <param name="outError">The error that occurred if the operation doesn't succeed</param>
 /// <returns>true on success, false otherwise</returns>
 public static bool c4indexer_emit(C4Indexer *indexer, C4Document *document, uint viewNumber,
     C4Key*[] emittedKeys, C4Slice[] emittedValues, C4Error *outError)
 {
     fixed(C4Key** keysPtr = emittedKeys)
     fixed(C4Slice* valuesPtr = emittedValues)
     {
         return c4indexer_emit(indexer, document, viewNumber, (uint)emittedKeys.Length, keysPtr, valuesPtr, outError);
     }
 }
Ejemplo n.º 5
0
 public static extern bool c4indexer_emit(C4Indexer *indexer, C4Document *document, uint viewNumber, uint emitCount,
     C4Key** emittedKeys, C4Slice* emittedValues, C4Error *outError);
Ejemplo n.º 6
0
        public static C4DocEnumerator *c4indexer_enumerateDocuments(C4Indexer *indexer, C4Error *outError)
        {
            #if DEBUG
            var retVal = _c4indexer_enumerateDocuments(indexer, outError);
            if(retVal != null) {
                _AllocatedObjects[(IntPtr)retVal] = "C4DocEnumerator";
                #if ENABLE_LOGGING
                Console.WriteLine("[c4indexer_enumerateDocuments] Allocated 0x{0}", ((IntPtr)retVal).ToString("X"));
                #endif
            }

            return retVal;
            #else
            return _c4indexer_enumerateDocuments(indexer, outError);
            #endif
        }
Ejemplo n.º 7
0
 private static extern C4DocEnumerator* _c4indexer_enumerateDocuments(C4Indexer *indexer, C4Error *outError);