public override IndexInput OpenInput(string name) { if (_blobMetaLookup == null) { ReloadMetadata(); } try { BlobMeta blobMeta; if (_blobMetaLookup.TryGetValue(name, out blobMeta) && blobMeta.HasData) { return(new FastAzureIndexInput(this, blobMeta)); } CloudBlockBlob blockBlobReference = this.BlobContainer.GetBlockBlobReference(_rootFolder + name); blockBlobReference.FastFetchAttribute(); BlobMeta newMeta; var input = new FastAzureIndexInput(this, blockBlobReference, out newMeta); if (newMeta.HasData) { BlobMeta tmp; if (_blobMetaLookup.TryRemove(name, out tmp)) { _blobMetaLookup.TryAdd(name, newMeta); } } return(input); } catch (Exception ex) { throw new FileNotFoundException(name, ex); } }
public FastAzureIndexInput(FastAzureIndexInput cloneInput) { this._fileMutex = BlobMutexManager.GrabMutex(cloneInput._name); this._fileMutex.WaitOne(); try { this._azureDirectory = cloneInput._azureDirectory; this._blobContainer = cloneInput._blobContainer; this._blob = cloneInput._blob; this._indexInput = cloneInput._indexInput.Clone() as IndexInput; } catch (Exception ex) { } finally { this._fileMutex.ReleaseMutex(); } }