Bloom.WebLibraryIntegration.BloomS3Client.GetBookFileCount C# (CSharp) Method

GetBookFileCount() private method

private GetBookFileCount ( string key, string bucketName ) : int
key string
bucketName string
return int
        internal int GetBookFileCount(string key, string bucketName)
        {
            var count = GetMatchingItems(key, bucketName).S3Objects.Count;
            return count;
        }

Usage Example

Example #1
0
        // Wait (up to three seconds) for data uploaded to become available.
        // Currently only used in unit testing.
        // I have no idea whether 3s is an adequate time to wait for 'eventual consistency'. So far it seems to work.
        internal void WaitUntilS3DataIsOnServer(string bookPath)
        {
            var s3Id  = S3BookId(BookMetaData.FromFolder(bookPath));
            var count = Directory.GetFiles(bookPath).Length;

            for (int i = 0; i < 30; i++)
            {
                var uploaded = _s3Client.GetBookFileCount(s3Id);
                if (uploaded >= count)
                {
                    return;
                }
                Thread.Sleep(100);
            }
            throw new ApplicationException("S3 is very slow today");
        }
All Usage Examples Of Bloom.WebLibraryIntegration.BloomS3Client::GetBookFileCount