コード例 #1
0
ファイル: StoreReader.cs プロジェクト: xiangzhi/psi
        /// <summary>
        /// Initializes a new instance of the <see cref="StoreReader"/> class.
        /// </summary>
        /// <param name="name">The name of the application that generated the persisted files, or the root name of the files.</param>
        /// <param name="path">The directory in which the main persisted file resides or will reside, or null to create a volatile data store.</param>
        /// <param name="metadataUpdateHandler">Delegate to call.</param>
        /// <param name="autoOpenAllStreams">Automatically open all streams.</param>
        public StoreReader(string name, string path, Action <IEnumerable <Metadata>, RuntimeInfo> metadataUpdateHandler, bool autoOpenAllStreams = false)
        {
            this.name = name;
            this.path = StoreCommon.GetPathToLatestVersion(name, path);
            this.autoOpenAllStreams = autoOpenAllStreams;

            // open the data readers
            this.messageReader      = new MessageReader(StoreCommon.GetDataFileName(this.name), this.path);
            this.largeMessageReader = new MessageReader(StoreCommon.GetLargeDataFileName(this.name), this.path);
            this.indexCache         = Shared.Create(new PageIndexCache(name, this.path));
            this.metadataCache      = Shared.Create(new MetadataCache(name, this.path, metadataUpdateHandler));
        }