private async ValueTask InitBlobAsync()
        {
            await _azurePageBlob.CreateIfNotExists();

            await _builder.ResizeIfLessAsync(_indexSize);

            _initialized = true;
        }
Exemple #2
0
 private ValueTask CreateIfNotExistsAsync()
 {
     if (_initialized)
     {
         return(new ValueTask());
     }
     _initialized = true;
     return(_azurePageBlob.CreateIfNotExists());
 }
        private async Task InitIndexPageAsync(bool createTocIfNotExists)
        {
            var exists = await AzurePageBlob.ExistsAsync();

            if (exists || createTocIfNotExists)
            {
                if (!exists)
                {
                    await AzurePageBlob.CreateIfNotExists();
                }

                await LoadTocAsync();
            }
        }
Exemple #4
0
        private async Task InitializeFromBlobAsync()
        {
            await _azurePageBlob.CreateIfNotExists();

            var dataFromBlob = await ReadContractAsync();

            lock (_lastPages)
            {
                foreach (var itm in dataFromBlob)
                {
                    if (_lastPages.ContainsKey(itm.TopicId))
                    {
                        _lastPages[itm.TopicId] = itm.PageId;
                    }
                    else
                    {
                        _lastPages.Add(itm.TopicId, itm.PageId);
                    }
                }
            }
            _initialized = true;
        }