Пример #1
0
 internal static async Task <IndexBTreeFileEnumerator <T> > Create(IndexBTreeFile File, IndexRecords RecordHandler)
 {
     return(new IndexBTreeFileEnumerator <T>()
     {
         file = File,
         recordHandler = RecordHandler,
         provider = File.ObjectFile.Provider,
         hasCurrent = false,
         currentObjectId = Guid.Empty,
         current = default,
Пример #2
0
        internal IndexBTreeFileEnumerator(IndexBTreeFile File, IndexRecords RecordHandler)
        {
            this.file                = File;
            this.recordHandler       = RecordHandler;
            this.provider            = this.file.ObjectFile.Provider;
            this.hasCurrent          = false;
            this.currentObjectId     = Guid.Empty;
            this.current             = default;
            this.currentSerializer   = null;
            this.timeoutMilliseconds = File.IndexFile.TimeoutMilliseconds;

            this.e = new ObjectBTreeFileEnumerator <object>(this.file.IndexFile, RecordHandler);
        }
        internal IndexBTreeFileEnumerator(IndexBTreeFile File, bool Locked, IndexRecords RecordHandler, BlockInfo StartingPoint)
        {
            this.file                = File;
            this.locked              = Locked;
            this.recordHandler       = RecordHandler;
            this.provider            = this.file.ObjectFile.Provider;
            this.hasCurrent          = false;
            this.currentObjectId     = Guid.Empty;
            this.current             = default(T);
            this.currentSerializer   = null;
            this.timeoutMilliseconds = File.IndexFile.TimeoutMilliseconds;

            this.e = new ObjectBTreeFileEnumerator <object>(this.file.IndexFile, Locked, RecordHandler, StartingPoint);
        }
Пример #4
0
        /// <summary>
        /// This class manages an index file to a <see cref="ObjectBTreeFile"/>.
        /// </summary>
        /// <param name="FileName">File name of index file.</param>
        /// <param name="ObjectFile">Object file storing actual objects.</param>
        /// <param name="Provider">Files provider.</param>
        /// <param name="FieldNames">Field names to build the index on. By default, sort order is ascending.
        /// If descending sort order is desired, prefix the corresponding field name by a hyphen (minus) sign.</param>
        internal static async Task <IndexBTreeFile> Create(string FileName, ObjectBTreeFile ObjectFile, FilesProvider Provider,
                                                           params string[] FieldNames)
        {
            IndexBTreeFile Result = new IndexBTreeFile()
            {
                objectFile     = ObjectFile,
                collectionName = ObjectFile.CollectionName,
                encoding       = ObjectFile.Encoding
            };

            Result.recordHandler     = new IndexRecords(Result.collectionName, Result.encoding, Result.objectFile.InlineObjectSizeLimit, FieldNames);
            Result.genericSerializer = new GenericObjectSerializer(Result.objectFile.Provider);

            Result.indexFile = await ObjectBTreeFile.Create(FileName, Result.collectionName, string.Empty, Result.objectFile.BlockSize,
                                                            Result.objectFile.BlobBlockSize, Provider, Result.encoding, Result.objectFile.TimeoutMilliseconds,
                                                            Result.objectFile.Encrypted, Result.recordHandler);

            Result.recordHandler.Index = Result;

            return(Result);
        }