/// <summary> /// Constructor for enumerating over all documents starting from a given sequence /// </summary> /// <param name="db">The database to retrieve documents from</param> /// <param name="lastSequence">The sequence to start enumerating from</param> /// <param name="options">The enumeration options (null for default).</param> public CBForestDocEnumerator(C4Database *db, long lastSequence, C4EnumeratorOptions options) { var options_ = &options; _currentDocInfo = (C4DocumentInfo *)Marshal.AllocHGlobal(sizeof(C4DocumentInfo)).ToPointer(); _e = (C4DocEnumerator *)RetryHandler.RetryIfBusy().Execute(err => Native.c4db_enumerateChanges(db, (ulong)lastSequence, options_, err)); }
/// <summary> /// Constructor for enumerating over a given subset of documents in a database /// </summary> /// <param name="db">The database to retrieve documents from</param> /// <param name="startKey">The key to start enumeration from</param> /// <param name="endKey">The key to end enumeration at</param> /// <param name="options">The enumeration options (null for default).</param> public CBForestDocEnumerator(C4Database *db, string startKey, string endKey, C4EnumeratorOptions options) { var options_ = &options; _currentDocInfo = (C4DocumentInfo *)Marshal.AllocHGlobal(sizeof(C4DocumentInfo)).ToPointer(); _e = (C4DocEnumerator *)RetryHandler.RetryIfBusy().Execute(err => Native.c4db_enumerateAllDocs(db, startKey, endKey, options_, err)); }
/// <summary> /// Constructor for enumerating over documents which need indexing /// by a given indexer /// </summary> /// <param name="indexer">The indexer to use for enumeration.</param> public CBForestDocEnumerator(C4Indexer *indexer) { _e = (C4DocEnumerator *)RetryHandler.RetryIfBusy().AllowError(0, C4ErrorDomain.Any) .Execute(err => Native.c4indexer_enumerateDocuments(indexer, err)); _currentDocInfo = (C4DocumentInfo *)Marshal.AllocHGlobal(sizeof(C4DocumentInfo)).ToPointer(); _validationLogic = doc => !((string)doc->docID).StartsWith("_design/"); }
/// <summary> /// Constructor /// </summary> /// <param name="doc">The document to retrieve information form.</param> /// <param name="owner">Whether or not the instance should own the /// document (i.e. free it when it is finished)</param> public CBForestDocStatus(C4Document *doc, bool owner) { DocumentInfo = (C4DocumentInfo *)Marshal.AllocHGlobal(sizeof(C4DocumentInfo)).ToPointer(); DocumentInfo->docID = doc->docID; DocumentInfo->revID = doc->revID; DocumentInfo->flags = doc->flags; DocumentInfo->sequence = doc->sequence; _document = doc; _owner = owner; Sequence = (long)doc->sequence; }
/// <summary> /// Constructor /// </summary> /// <param name="docInfo">The document metadata to get information from</param> /// <param name="e">The enumerator currently being enumerated</param> /// <param name="owner">Whether or not the instance should own the /// document (i.e. free it when it is finished)</param> public CBForestDocStatus(C4DocumentInfo *docInfo, C4DocEnumerator *e, bool owner) { _parent = e; DocumentInfo = docInfo; _owner = owner; Sequence = (long)docInfo->sequence; if (!_owner) { GC.SuppressFinalize(this); } }
public static extern bool c4enum_getDocumentInfo(C4DocEnumerator *e, C4DocumentInfo *outInfo);
public bool c4enum_getDocumentInfo(C4DocEnumerator *e, C4DocumentInfo *outInfo) => Native.c4enum_getDocumentInfo(e, outInfo);
public static bool c4enum_getDocumentInfo(C4DocEnumerator *e, C4DocumentInfo *outInfo) => Impl.c4enum_getDocumentInfo(e, outInfo);