Пример #1
0
 public DocumentServiceLeaseContainerCosmos(
     Container container,
     DocumentServiceLeaseStoreManagerOptions options)
 {
     this.container = container;
     this.options   = options;
 }
 public DocumentServiceLeaseStoreManagerCosmos(
     DocumentServiceLeaseStoreManagerOptions options,
     Container leaseContainer,
     RequestOptionsFactory requestOptionsFactory)
     : this(options, leaseContainer, requestOptionsFactory, new DocumentServiceLeaseUpdaterCosmos(leaseContainer))
 {
 }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentServiceLeaseStoreManagerCosmos"/> class.
        /// </summary>
        /// <remarks>
        /// Internal only for testing purposes, otherwise would be private.
        /// </remarks>
        internal DocumentServiceLeaseStoreManagerCosmos(
            DocumentServiceLeaseStoreManagerOptions options,
            ContainerInternal monitoredContainer,
            ContainerInternal leaseContainer,
            RequestOptionsFactory requestOptionsFactory,
            DocumentServiceLeaseUpdater leaseUpdater) // For testing purposes only.
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (options.ContainerNamePrefix == null)
            {
                throw new ArgumentNullException(nameof(options.ContainerNamePrefix));
            }
            if (string.IsNullOrEmpty(options.HostName))
            {
                throw new ArgumentNullException(nameof(options.HostName));
            }
            if (monitoredContainer == null)
            {
                throw new ArgumentNullException(nameof(monitoredContainer));
            }
            if (leaseContainer == null)
            {
                throw new ArgumentNullException(nameof(leaseContainer));
            }
            if (requestOptionsFactory == null)
            {
                throw new ArgumentException(nameof(requestOptionsFactory));
            }
            if (leaseUpdater == null)
            {
                throw new ArgumentException(nameof(leaseUpdater));
            }

            this.leaseStore = new DocumentServiceLeaseStoreCosmos(
                leaseContainer,
                options.ContainerNamePrefix,
                requestOptionsFactory);

            this.leaseManager = new DocumentServiceLeaseManagerCosmos(
                monitoredContainer,
                leaseContainer,
                leaseUpdater,
                options,
                requestOptionsFactory);

            this.leaseCheckpointer = new DocumentServiceLeaseCheckpointerCore(
                leaseUpdater,
                requestOptionsFactory);

            this.leaseContainer = new DocumentServiceLeaseContainerCosmos(
                leaseContainer,
                options);
        }
Пример #4
0
 public DocumentServiceLeaseManagerCosmos(
     Container leaseContainer,
     DocumentServiceLeaseUpdater leaseUpdater,
     DocumentServiceLeaseStoreManagerOptions options,
     RequestOptionsFactory requestOptionsFactory)
 {
     this.leaseContainer        = leaseContainer;
     this.leaseUpdater          = leaseUpdater;
     this.options               = options;
     this.requestOptionsFactory = requestOptionsFactory;
 }
 public DocumentServiceLeaseManagerCosmos(
     ContainerInternal monitoredContainer,
     ContainerInternal leaseContainer,
     DocumentServiceLeaseUpdater leaseUpdater,
     DocumentServiceLeaseStoreManagerOptions options,
     RequestOptionsFactory requestOptionsFactory)
 {
     this.monitoredContainer    = monitoredContainer;
     this.leaseContainer        = leaseContainer;
     this.leaseUpdater          = leaseUpdater;
     this.options               = options;
     this.requestOptionsFactory = requestOptionsFactory;
     this.lazyContainerRid      = new AsyncLazy <TryCatch <string> >(valueFactory: (trace, innerCancellationToken) => this.TryInitializeContainerRIdAsync(innerCancellationToken));
 }