コード例 #1
0
        public static async ValueTask <PersistentIndex> ReadFromBlobAsync(IBlobManager blobManager, string baseBlobPath, IEnumerable <int> forkInformation, int versionNumber)
        {
            string path = GetPathForIndex(baseBlobPath, forkInformation, versionNumber);
            ReadOnlyMemory <byte> bytes = await blobManager.ReadAllAsync(path);

            return(CreateFromBytes(blobManager, bytes));
        }
コード例 #2
0
        public void WriteBlobWorks(bool useFile)
        {
            IBlobManager blobManager = useFile ? new FileBlobManager() : new InMemoryBlobManager();
            string       path        = GetPathForIndexAndBlobs(useFile);

            if (path == null)
            {
                return;
            }
            if (blobManager.Exists(path))
            {
                blobManager.Delete(path);
            }

            var data = new byte[] { 1, 2, 3 };

            blobManager.Write(path, data);
            long length = blobManager.GetLength(path);
            var  result = blobManager.Read(path, 0, (int)length);

            result.ToArray().SequenceEqual(data).Should().BeTrue();

            data = new byte[] { 4, 5, 6 };
            blobManager.Write(path, data);
            length = blobManager.GetLength(path);
            result = blobManager.Read(path, 0, (int)length);
            result.ToArray().SequenceEqual(data).Should().BeTrue();
            result = blobManager.ReadAll(path);
            result.ToArray().SequenceEqual(data).Should().BeTrue();
        }
コード例 #3
0
        public SqlServerWithExternalBlobDataProvider(string connectionString) : base(connectionString)
        {
            _blobLockSet = new LockSet();

            if (string.IsNullOrWhiteSpace(BlobManagerHelper.BlobManagerType))
            {
                Log.Error("ExternalBlobDataProvider not configured. Using Sitecore default.", this);
                _configured = false;
                return;
            }
            try
            {
                Log.Info($"Initializing ExternalBlobDataProvider using {BlobManagerHelper.BlobManagerType}", this);
                _blobManager = ReflectionUtil.CreateObject(BlobManagerHelper.BlobManagerType) as IBlobManager;
                if (_blobManager == null)
                {
                    Log.Error($"Unable to create IBlobManager of type {BlobManagerHelper.BlobManagerType}. Using Sitecore default.", this);
                    _configured = false;
                    return;
                }
                _blobManager.Initialize();
                _configured = true;
            }
            catch (Exception ex)
            {
                Log.Error($"Unable to initialize ExternalBlobDataProvider {BlobManagerHelper.BlobManagerType}. Using Sitecore default", ex, this);
                _configured = false;
            }
        }
 public MediaController(IMapper mapper, IBlobManager blobManager, IBlobService blobService, IEquipmentBlobManager equipmentBlobManager)
 {
     __Mapper               = mapper ?? throw new ArgumentNullException(nameof(mapper));
     __BlobManager          = blobManager ?? throw new ArgumentNullException(nameof(blobManager));
     __BlobService          = blobService ?? throw new ArgumentNullException(nameof(blobService));
     __EquipmentBlobManager = equipmentBlobManager ?? throw new ArgumentNullException(nameof(equipmentBlobManager));
 }
コード例 #5
0
        public void AppendBlobWorks(bool useFile)
        {
            IBlobManager blobManager = useFile ? new FileBlobManager() : new InMemoryBlobManager();
            string       path        = GetPathForIndexAndBlobs(useFile);

            if (path == null)
            {
                return;
            }
            if (blobManager.Exists(path))
            {
                blobManager.Delete(path);
            }

            blobManager.OpenForWriting(path);
            var data = new byte[] { 1, 2, 3, 4, 5, 6 };

            blobManager.Append(path, data.Take(3).ToArray());
            blobManager.Append(path, data.Skip(3).ToArray());
            blobManager.CloseAfterWriting(path);
            long length = blobManager.GetLength(path);
            var  result = blobManager.Read(path, 0, (int)length);

            result.ToArray().SequenceEqual(data).Should().BeTrue();

            blobManager.Delete(path);
            data = new byte[] { 1, 2, 3, 4, 5, 6 };
            blobManager.Append(path, data.Take(3).ToArray());
            blobManager.Append(path, data.Skip(3).ToArray());
            length = blobManager.GetLength(path);
            result = blobManager.Read(path, 0, (int)length);
            result.ToArray().SequenceEqual(data).Should().BeTrue();
        }
コード例 #6
0
        public async Task BinaryTreeTest_ReloadingFromBlobsAsync(bool useFile, bool containedInSingleBlob, bool recreateIndex, bool poolMemory)
        {
            IBlobManager blobManager = GetBlobManager(useFile, poolMemory);
            string       fullPath    = GetPathForIndexAndBlobs(useFile, true);

            if (fullPath == null)
            {
                return;
            }
            await MultipleRoundsOfRandomChangesAsync(10, 10, 10, async() =>
            {
                LazinatorMemory multipleBufferResult = BinaryTree.SerializeLazinator(new LazinatorSerializationOptions(IncludeChildrenMode.IncludeAllChildren, false, false, false, 5));

                // Write to one or more blobs
                PersistentIndex index = new PersistentIndex(fullPath, blobManager, containedInSingleBlob);
                await index.PersistLazinatorMemoryAsync(multipleBufferResult);

                if (recreateIndex)
                {
                    index = await PersistentIndex.ReadFromBlobAsync(blobManager, fullPath, null, index.IndexVersion);
                }
                var revisedMemory = await index.GetLazinatorMemoryAsync();
                BinaryTree        = new LazinatorBinaryTree <WDouble>(revisedMemory);
            });

            if (poolMemory)
            {
                blobManager.MemoryAllocator.FreeMemory(fullPath);
            }
        }
コード例 #7
0
        private async Task SplittableEntitiesSavedHelper_Async(bool containedInSingleBlob, bool useFile, bool recreateIndex, bool poolMemory)
        {
            Example         e = GetTypicalExample();
            LazinatorMemory multipleBufferResult = await e.SerializeLazinatorAsync(new LazinatorSerializationOptions(IncludeChildrenMode.IncludeAllChildren, false, false, false, 10));

            // Write to one or more blobs
            IBlobManager blobManager = GetBlobManager(useFile, poolMemory);
            string       fullPath    = GetPathForIndexAndBlobs(useFile, false);

            if (fullPath == null)
            {
                return;
            }
            PersistentIndex index = new PersistentIndex(fullPath, blobManager, containedInSingleBlob);
            await index.PersistLazinatorMemoryAsync(multipleBufferResult);

            // Note: Index reference is first var indexReference = memoryReferenceInBlobs[0];

            // Read from one or more blobs
            if (recreateIndex)
            {
                index = await PersistentIndex.ReadFromBlobAsync(blobManager, fullPath, null, index.IndexVersion);
            }
            var revisedMemory = await index.GetLazinatorMemoryAsync();

            Example e2 = new Example(revisedMemory);

            ExampleEqual(e, e2).Should().BeTrue();
            if (poolMemory)
            {
                blobManager.MemoryAllocator.FreeMemory(fullPath);
            }
        }
コード例 #8
0
        private static PersistentIndex CreateFromBytes(IBlobManager blobManager, ReadOnlyMemory <byte> bytes)
        {
            var index = new PersistentIndex(new LazinatorMemory(bytes));

            index.BlobManager = blobManager;
            return(index);
        }
コード例 #9
0
        /// <summary>
        /// Constructor for the <see cref="OperationConfigurationsFacade"/>.
        /// </summary>
        /// <param name="context">Database context containing dashboard type entities.</param>
        /// <param name="blobManager">Manager for Azure Blob Storage.</param>
        /// <param name="queueManager">Manager for Azure Queue Storage.</param>
        /// <param name="documentDb">Azure DocumentDB repository</param>
        public OperationConfigurationsFacade(DataContext context, IBlobManager blobManager, IQueueManager queueManager,
                                             IDocumentDbRepository <UploadTransaction> documentDb)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (blobManager == null)
            {
                throw new ArgumentNullException(nameof(blobManager));
            }
            if (queueManager == null)
            {
                throw new ArgumentNullException(nameof(queueManager));
            }
            if (documentDb == null)
            {
                throw new ArgumentNullException(nameof(documentDb));
            }

            _blobStorageConnectionString = ConfigurationManager.ConnectionStrings["BlobProcessorStorageConnectionString"].ConnectionString;
            _blobStorageContainerName    = ConfigurationManager.AppSettings["BlobProcessorBlobStorageContainerName"];
            _queueStorageContainerName   = ConfigurationManager.AppSettings["BlobProcessorQueueStorageContainerName"];

            _context      = context;
            _blobManager  = blobManager;
            _queueManager = queueManager;
            _documentDb   = documentDb;
        }
コード例 #10
0
 public AssetController(IAssetManager assetManager, IConfiguration configuration, IBlobManager blobManager, IAnalysisManager analysisManager)
 {
     _assetManager    = assetManager;
     _configuration   = configuration;
     _blobManager     = blobManager;
     _analysisManager = analysisManager;
 }
コード例 #11
0
 /// <summary>
 /// Prepares for index file to be created, not based on any previous index
 /// </summary>
 /// <param name="baseBlobPath"></param>
 public PersistentIndex(string baseBlobPath, IBlobManager blobManager, bool containedInSingleBlob)
 {
     BaseBlobPath          = baseBlobPath;
     BlobManager           = blobManager;
     ContainedInSingleBlob = containedInSingleBlob;
     IsPersisted           = false;
     IndexVersion          = 0;
 }
コード例 #12
0
        public void PersistentIndexTest(bool useFile, bool containedInSingleBlob, bool recreateIndex)
        {
            List <byte> fullSequence = new List <byte>()
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            };
            var initialBytes = new ReadOnlyBytes(new byte[3] {
                1, 2, 3
            });
            var nextBytes = new ReadOnlyBytes(new byte[3] {
                4, 5, 6
            });
            MemoryChunk nextBytesAsChunk = new MemoryChunk(nextBytes, new MemoryBlockLoadingInfo(1, 3), false);
            var         lastBytes        = new ReadOnlyBytes(new byte[4] {
                7, 8, 9, 10
            });
            MemoryChunk     lastBytesAsChunk = new MemoryChunk(lastBytes, new MemoryBlockLoadingInfo(2, 4), false);
            LazinatorMemory initialMemory    = new LazinatorMemory(initialBytes);
            LazinatorMemory memory1          = initialMemory.WithAppendedChunk(nextBytesAsChunk).WithAppendedChunk(lastBytesAsChunk);

            IBlobManager blobManager = useFile ? new FileBlobManager() : new InMemoryBlobManager();
            string       fullPath    = GetPathForIndexAndBlobs(useFile, true);

            if (fullPath == null)
            {
                return;
            }
            PersistentIndex index = new PersistentIndex(fullPath, blobManager, containedInSingleBlob);

            index.PersistLazinatorMemory(memory1);

            if (recreateIndex)
            {
                index = PersistentIndex.ReadFromBlob(blobManager, fullPath, null, index.IndexVersion);
            }
            var memory2     = index.GetLazinatorMemory();
            var memory2List = memory2.GetConsolidatedMemory().ToArray().ToList();

            memory2List.SequenceEqual(fullSequence).Should().BeTrue();

            BufferWriter writer = new BufferWriter(0, memory2);

            writer.Write((byte)11);
            writer.Write((byte)12);
            writer.InsertReferenceToCompletedMemory(2, 1, 2); // 8, 9
            writer.InsertReferenceToCompletedMemory(0, 0, 3); // 1, 2, 3
            writer.InsertReferenceToCompletedMemory(1, 1, 1); // 5
            writer.InsertReferenceToCompletedMemory(2, 0, 2); // 7, 8
            writer.Write((byte)13);
            var         memory3     = writer.LazinatorMemory;
            var         memory3List = memory3.GetConsolidatedMemory().ToArray().ToList();
            List <byte> expected    = new List <byte>()
            {
                11, 12, 8, 9, 1, 2, 3, 5, 7, 8, 13
            };

            memory3List.SequenceEqual(expected).Should().BeTrue();
        }
コード例 #13
0
        public void BinaryTreeTest_DiffSerialization(bool useFile, bool containedInSingleBlob, bool recreateIndex, bool neverIncludeReferenceToPreviousBuffer, bool useConsolidatedMemory)
        {
            List <PersistentIndex> indices     = new List <PersistentIndex>();
            IBlobManager           blobManager = useFile ? new FileBlobManager() : new InMemoryBlobManager();
            string fullPath = GetPathForIndexAndBlobs(useFile, true);

            if (fullPath == null)
            {
                return;
            }
            int round                      = 0;
            int numRounds                  = 2; // DEBUG 10
            int numChangesFirstRound       = 1; // DEBUG 10
            int numChangesSubsequentRounds = 1; // DEBUG 3

            MultipleRoundsOfRandomChanges(numRounds, numChangesFirstRound, numChangesSubsequentRounds, () =>
            {
                //Debug.WriteLine($"Round {round}");

                LazinatorSerializationOptions options = neverIncludeReferenceToPreviousBuffer ? new LazinatorSerializationOptions(IncludeChildrenMode.IncludeAllChildren, false, false, true, int.MaxValue, int.MaxValue) : new LazinatorSerializationOptions(IncludeChildrenMode.IncludeAllChildren, false, false, true, 20, 5);
                LazinatorMemory multipleBufferResult  = BinaryTree.SerializeLazinator(options);

                // DEBUG
                Debug.WriteLine("Multiple buffer result:");
                Debug.WriteLine(multipleBufferResult.ToStringByChunk());
                Debug.WriteLine($"Consolidated{round}: " + multipleBufferResult.ToStringConsolidated());

                // Write to one or more blobs
                var index = (useConsolidatedMemory || indices == null || !indices.Any()) ? new PersistentIndex(fullPath, blobManager, containedInSingleBlob) : new PersistentIndex(indices.Last());
                index.PersistLazinatorMemory(multipleBufferResult);
                indices.Add(index);

                if (recreateIndex)
                {
                    index = PersistentIndex.ReadFromBlob(blobManager, fullPath, null, index.IndexVersion);
                }
                var revisedMemory = index.GetLazinatorMemory();
                if (useConsolidatedMemory)
                {
                    var consolidatedMemory = revisedMemory.GetConsolidatedMemory();
                    revisedMemory          = new LazinatorMemory(consolidatedMemory);
                    if (round != numRounds - 1)
                    {
                        indices.RemoveAt(0); // with consolidated memory, we're not using diff serialization
                    }
                }

                // DEBUG
                Debug.WriteLine("Revised memory result:");
                Debug.WriteLine(revisedMemory.ToStringByChunk());
                Debug.WriteLine($"Consolidated{round}: " + revisedMemory.ToStringConsolidated());

                BinaryTree = new LazinatorBinaryTree <WDouble>(revisedMemory);
                round++;
            });
            DeleteChunksAndIndex(useConsolidatedMemory, indices, blobManager);
        }
コード例 #14
0
        private static IBlobManager GetBlobManager(bool useFile, bool poolMemory)
        {
            IBlobManager manager = useFile ? new FileBlobManager() : new InMemoryBlobManager();

            if (poolMemory)
            {
                manager.MemoryAllocator = new PooledBlobMemoryAllocator();
            }
            return(manager);
        }
コード例 #15
0
ファイル: BlobEntry.cs プロジェクト: microsoft/FASTER
 /// <summary>
 /// Creates a new BlobEntry to hold the given pageBlob. The pageBlob must already be created.
 /// </summary>
 /// <param name="pageBlob"></param>
 /// <param name="blobManager"></param>
 public BlobEntry(CloudPageBlob pageBlob, IBlobManager blobManager)
 {
     this.PageBlob    = pageBlob;
     this.blobManager = blobManager;
     if (pageBlob == null)
     {
         // Only need to allocate a queue when we potentially need to asynchronously create a blob
         pendingWrites = new ConcurrentQueue <Action <CloudPageBlob> >();
         waitingCount  = 0;
     }
 }
コード例 #16
0
ファイル: EventHandler.cs プロジェクト: Begunini/Notificall
 public EventHandler(IEventManager eventManager, ISourceManager sourceManager, ITextManager textManager,
                     ICallManager callManager, IVoiceService voiceService, IBlobManager blobManager, ITelephonyHandler telephonyHandler)
 {
     _eventManager     = eventManager;
     _sourceManager    = sourceManager;
     _textManager      = textManager;
     _callManager      = callManager;
     _voiceService     = voiceService;
     _blobManager      = blobManager;
     _telephonyHandler = telephonyHandler;
     _textConverter    = new TemplateToTextConverter();
     _audioConverter   = new AudioFileConverter();
 }
コード例 #17
0
        public async Task BinaryTreeTest_DiffSerializationAsync(bool useFile, bool containedInSingleBlob, bool recreateIndex, bool neverIncludeReferenceToPreviousBuffer, bool useConsolidatedMemory)
        {
            List <PersistentIndex> indices     = new List <PersistentIndex>();
            IBlobManager           blobManager = useFile ? new FileBlobManager() : new InMemoryBlobManager();
            string fullPath = GetPathForIndexAndBlobs(useFile, true);

            if (fullPath == null)
            {
                return;
            }
            int round     = 0;
            int numRounds = 10;

            await MultipleRoundsOfRandomChangesAsync(numRounds, 10, 3, async() =>
            {
                //Debug.WriteLine($"Round {round}");

                LazinatorSerializationOptions options = neverIncludeReferenceToPreviousBuffer ? new LazinatorSerializationOptions(IncludeChildrenMode.IncludeAllChildren, false, false, true, int.MaxValue, int.MaxValue) : new LazinatorSerializationOptions(IncludeChildrenMode.IncludeAllChildren, false, false, true, 20, 5);
                LazinatorMemory multipleBufferResult  = await BinaryTree.SerializeLazinatorAsync(options);

                // Write to one or more blobs
                var index = (useConsolidatedMemory || indices == null || !indices.Any()) ? new PersistentIndex(fullPath, blobManager, containedInSingleBlob) : new PersistentIndex(indices.Last());
                await index.PersistLazinatorMemoryAsync(multipleBufferResult);
                indices.Add(index);

                if (recreateIndex)
                {
                    index = await PersistentIndex.ReadFromBlobAsync(blobManager, fullPath, null, index.IndexVersion);
                }
                var revisedMemory = index.GetLazinatorMemory();
                if (useConsolidatedMemory)
                {
                    var consolidatedMemory = await revisedMemory.GetConsolidatedMemoryAsync();
                    revisedMemory          = new LazinatorMemory(consolidatedMemory);
                    if (round != numRounds - 1)
                    {
                        indices.RemoveAt(0); // with consolidated memory, we're not using diff serialization
                    }
                }

                //Debug.WriteLine(revisedMemory.ToStringByChunk());
                //Debug.WriteLine($"Consolidated{round}: " + revisedMemory.ToStringConsolidated());

                BinaryTree = new LazinatorBinaryTree <WDouble>(revisedMemory);
                round++;
            });

            DeleteChunksAndIndex(useConsolidatedMemory, indices, blobManager); // note that there is no DeleteAsync, so we use the same methods here
        }
コード例 #18
0
 public EquipmentController(IMapper mapper, IEquipmentManager equipmentManager,
                            INoteManager noteManager, IEmailScheduleManager emailScheduleManager,
                            IBlobManager blobManager, IEquipmentBlobManager equipmentBlobManager,
                            IBlobService blobService, ILoanManager loanManager, ILoanEquipmentManager loanEquipmentManager)
 {
     __Mapper               = mapper ?? throw new ArgumentNullException(nameof(mapper));
     __EquipmentManager     = equipmentManager ?? throw new ArgumentNullException(nameof(equipmentManager));
     __NoteManager          = noteManager ?? throw new ArgumentNullException(nameof(noteManager));
     __EmailScheduleManager = emailScheduleManager ?? throw new ArgumentNullException(nameof(emailScheduleManager));
     __BlobManager          = blobManager ?? throw new ArgumentNullException(nameof(blobManager));
     __EquipmentBlobManager = equipmentBlobManager ?? throw new ArgumentNullException(nameof(equipmentBlobManager));
     __BlobService          = blobService ?? throw new ArgumentNullException(nameof(blobService));
     __LoanManager          = loanManager ?? throw new ArgumentNullException(nameof(loanManager));
     __LoanEquipmentManager = loanEquipmentManager ?? throw new ArgumentNullException(nameof(loanEquipmentManager));
 }
コード例 #19
0
        public async Task BinaryTreeTest_DiffSerialization_RewritingAll_Async(bool useFile, bool containedInSingleBlob, bool recreateIndex, bool poolMemory)
        {
            // Here, we test making a change that in fact requires rewriting the entire Lazinator object. The change will be to the
            // only node's Data, and the node has no Left or Right, so no references to the original data can be made.

            var tree1 = new LazinatorBinaryTree <WByte>();

            tree1.Add(1);
            LazinatorMemory initialResult = await tree1.SerializeLazinatorAsync(LazinatorSerializationOptions.Default);

            var tree2 = new LazinatorBinaryTree <WByte>(initialResult);

            tree2.Root.Data = 2;
            LazinatorSerializationOptions options = new LazinatorSerializationOptions(IncludeChildrenMode.IncludeAllChildren, false, false, true, 20);
            LazinatorMemory afterChange           = await tree2.SerializeLazinatorAsync(options);

            IBlobManager blobManager = GetBlobManager(useFile, poolMemory);
            string       fullPath    = GetPathForIndexAndBlobs(useFile, true);

            if (fullPath == null)
            {
                return;
            }
            PersistentIndex index = new PersistentIndex(fullPath, blobManager, containedInSingleBlob);
            await index.PersistLazinatorMemoryAsync(afterChange);

            if (recreateIndex)
            {
                index = PersistentIndex.ReadFromBlob(blobManager, fullPath, null, index.IndexVersion);
            }
            var afterChangeReloaded = await index.GetLazinatorMemoryAsync();

            var tree3 = new LazinatorBinaryTree <WByte>(afterChangeReloaded);

            tree3.Root.Data.WrappedValue.Should().Be((byte)2);

            var tree4 = new LazinatorBinaryTree <WByte>(afterChange);

            tree4.Root.Data.WrappedValue.Should().Be((byte)2);
            if (poolMemory)
            {
                blobManager.MemoryAllocator.FreeMemory(fullPath);
            }
        }
コード例 #20
0
        /// <summary>
        /// Constructor for the <see cref="FileFacade"/> class taking datbase context, DocumentDb repository,
        /// and blob manager arguments.
        /// </summary>
        /// <param name="context">Database context used to access user and tenant information.</param>
        /// <param name="documentDb">Azure DocumentDB repository containing file metadata.</param>
        /// <param name="blobManager">Manager used to access Azure Blob Storage.</param>
        public FileFacade(DataContext context, IDocumentDbRepository <UploadTransaction> documentDb, IBlobManager blobManager)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (documentDb == null)
            {
                throw new ArgumentNullException(nameof(documentDb));
            }
            if (blobManager == null)
            {
                throw new ArgumentNullException(nameof(blobManager));
            }

            _context     = context;
            _blobManager = blobManager;
            _documentDb  = documentDb;

            _blobStorageConnectionString = ConfigurationManager.ConnectionStrings["BlobProcessorStorageConnectionString"].ConnectionString;
        }
コード例 #21
0
        public void BinaryTreeTest_DiffSerialization_KeepingSomeInformation(bool useFile, bool containedInSingleBlob, bool recreateIndex)
        {
            // Here, we test making a change that in fact requires rewriting the entire Lazinator object. The change will be to the
            // only node's Data, and the node has no Left or Right, so no references to the original data can be made.

            var tree1 = new LazinatorBinaryTree <WByte>();

            tree1.Add(1);
            tree1.Add(3); // right node to above
            LazinatorMemory initialResult = tree1.SerializeLazinator(LazinatorSerializationOptions.Default);

            var tree2 = new LazinatorBinaryTree <WByte>(initialResult);

            tree2.Root.Data = 2; // should now be 2 and 3
            LazinatorSerializationOptions options = new LazinatorSerializationOptions(IncludeChildrenMode.IncludeAllChildren, false, false, true, 20);
            LazinatorMemory afterChange           = tree2.SerializeLazinator(options);

            IBlobManager    blobManager = useFile ? new FileBlobManager() : new InMemoryBlobManager();
            string          fullPath    = GetPathForIndexAndBlobs(useFile, true);
            PersistentIndex index       = new PersistentIndex(fullPath, blobManager, containedInSingleBlob);

            index.PersistLazinatorMemory(afterChange);

            if (recreateIndex)
            {
                index = PersistentIndex.ReadFromBlob(blobManager, fullPath, null, index.IndexVersion);
            }
            var afterChangeReloaded = index.GetLazinatorMemory();
            var tree3 = new LazinatorBinaryTree <WByte>(afterChangeReloaded);

            tree3.Root.Data.WrappedValue.Should().Be((byte)2);
            tree3.Root.RightNode.Data.WrappedValue.Should().Be((byte)3);


            var tree4 = new LazinatorBinaryTree <WByte>(afterChange);

            tree4.Root.Data.WrappedValue.Should().Be((byte)2);
            tree4.Root.RightNode.Data.WrappedValue.Should().Be((byte)3);
        }
コード例 #22
0
ファイル: AzureStorageDevice.cs プロジェクト: okwh/FASTER
        /// <summary>
        /// Constructs a new AzureStorageDevice instance, backed by Azure Page Blobs
        /// </summary>
        /// <param name="connectionString"> The connection string to use when estblishing connection to Azure Blobs</param>
        /// <param name="containerName">Name of the Azure Blob container to use. If there does not exist a container with the supplied name, one is created</param>
        /// <param name="directoryName">Directory within blob container to use.</param>
        /// <param name="blobName">A descriptive name that will be the prefix of all blobs created with this device</param>
        /// <param name="blobManager">Blob manager instance</param>
        /// <param name="underLease">Whether we use leases</param>
        /// <param name="deleteOnClose">
        /// True if the program should delete all blobs created on call to <see cref="Dispose">Close</see>. False otherwise.
        /// The container is not deleted even if it was created in this constructor
        /// </param>
        /// <param name="capacity">The maximum number of bytes this storage device can accommondate, or CAPACITY_UNSPECIFIED if there is no such limit </param>
        public AzureStorageDevice(string connectionString, string containerName, string directoryName, string blobName, IBlobManager blobManager = null, bool underLease = false, bool deleteOnClose = false, long capacity = Devices.CAPACITY_UNSPECIFIED)
            : base($"{connectionString}\\{containerName}\\{directoryName}\\{blobName}", PAGE_BLOB_SECTOR_SIZE, capacity)
        {
            var storageAccount = CloudStorageAccount.Parse(connectionString);
            var client         = storageAccount.CreateCloudBlobClient();
            var container      = client.GetContainerReference(containerName);

            container.CreateIfNotExists();

            this.blobs         = new ConcurrentDictionary <int, BlobEntry>();
            this.blobDirectory = container.GetDirectoryReference(directoryName);
            this.blobName      = blobName;
            this.underLease    = underLease;
            this.deleteOnClose = deleteOnClose;

            this.BlobManager        = blobManager ?? new DefaultBlobManager(this.underLease, this.blobDirectory);
            this.BlobRequestOptions = BlobManager.GetBlobRequestOptions();

            StartAsync().Wait();
        }
コード例 #23
0
ファイル: AzureStorageDevice.cs プロジェクト: okwh/FASTER
        /// <summary>
        /// Constructs a new AzureStorageDevice instance, backed by Azure Page Blobs
        /// </summary>
        /// <param name="cloudBlobDirectory">Cloud blob directory containing the blobs</param>
        /// <param name="blobName">A descriptive name that will be the prefix of all blobs created with this device</param>
        /// <param name="blobManager">Blob manager instance</param>
        /// <param name="underLease">Whether we use leases</param>
        /// <param name="deleteOnClose">
        /// True if the program should delete all blobs created on call to <see cref="Dispose">Close</see>. False otherwise.
        /// The container is not deleted even if it was created in this constructor
        /// </param>
        /// <param name="capacity">The maximum number of bytes this storage device can accommondate, or CAPACITY_UNSPECIFIED if there is no such limit </param>
        public AzureStorageDevice(CloudBlobDirectory cloudBlobDirectory, string blobName, IBlobManager blobManager = null, bool underLease = false, bool deleteOnClose = false, long capacity = Devices.CAPACITY_UNSPECIFIED)
            : base($"{cloudBlobDirectory}\\{blobName}", PAGE_BLOB_SECTOR_SIZE, capacity)
        {
            this.blobs         = new ConcurrentDictionary <int, BlobEntry>();
            this.blobDirectory = cloudBlobDirectory;
            this.blobName      = blobName;
            this.underLease    = underLease;
            this.deleteOnClose = deleteOnClose;

            this.BlobManager        = blobManager ?? new DefaultBlobManager(this.underLease, this.blobDirectory);
            this.BlobRequestOptions = BlobManager.GetBlobRequestOptions();

            StartAsync().Wait();
        }
コード例 #24
0
 public UploaderController(IBlobManager _blobManager, IAppSettings _appSettings)
 {
     blobManager = _blobManager;
     appSettings = _appSettings;
 }
コード例 #25
0
 public BlobTransferer(string connectionString, IBlobManager blobManager)
 {
     _connectionString = connectionString;
     _blobManager      = blobManager;
     _blobLockSet      = new LockSet();
 }
コード例 #26
0
ファイル: UploadController.cs プロジェクト: Chidelma/AutoKnct
 public UploadController(IS3Service service, SCARFContext context, IConfiguration configuration, IBlobManager serviceBlob)
 {
     _serviceBlob = serviceBlob;
     _service     = service;
     _context     = context;
 }
コード例 #27
0
 public UploadController(IBlobManager blobManager)
 {
     _blobManager = blobManager;
 }
コード例 #28
0
 public LocationController(ILocationService locationService, IBlobManager blobManager)
 {
     _locationService = locationService;
     _blobManager     = blobManager;
 }
コード例 #29
0
 /// <summary>
 /// Creates a reference to an existing blob. This is called internally by GetAdditionalReferences(Async), after a call to MemoryReferenceInFile.
 /// </summary>
 public BlobMemoryChunk(string path, IBlobManager blobManager, MemoryBlockLoadingInfo loadingInfo) : base(null, loadingInfo, true)
 {
     BlobPath    = path;
     BlobManager = blobManager;
 }
コード例 #30
0
ファイル: BlobEntry.cs プロジェクト: microsoft/FASTER
 /// <summary>
 /// Creates a new BlobEntry, does not initialize a page blob. Use <see cref="CreateAsync(long, CloudPageBlob)"/>
 /// for actual creation.
 /// </summary>
 public BlobEntry(IBlobManager blobManager) : this(null, blobManager)
 {
 }