public DocumentServiceLeaseStoreManagerCosmos(
     DocumentServiceLeaseStoreManagerSettings settings,
     CosmosContainer leaseContainer,
     RequestOptionsFactory requestOptionsFactory)
     : this(settings, leaseContainer, requestOptionsFactory, new DocumentServiceLeaseUpdaterCosmos(leaseContainer))
 {
 }
Exemplo n.º 2
0
 public DocumentServiceLeaseContainerCosmos(
     CosmosContainer container,
     DocumentServiceLeaseStoreManagerSettings settings)
 {
     this.container = container;
     this.settings  = settings;
 }
 public DocumentServiceLeaseManagerCosmos(
     CosmosContainer leaseContainer,
     DocumentServiceLeaseUpdater leaseUpdater,
     DocumentServiceLeaseStoreManagerSettings settings,
     RequestOptionsFactory requestOptionsFactory)
 {
     this.leaseContainer        = leaseContainer;
     this.leaseUpdater          = leaseUpdater;
     this.settings              = settings;
     this.requestOptionsFactory = requestOptionsFactory;
 }
        /// <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(
            DocumentServiceLeaseStoreManagerSettings settings,
            CosmosContainer container,
            RequestOptionsFactory requestOptionsFactory,
            DocumentServiceLeaseUpdater leaseUpdater) // For testing purposes only.
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (settings.ContainerNamePrefix == null)
            {
                throw new ArgumentNullException(nameof(settings.ContainerNamePrefix));
            }
            if (string.IsNullOrEmpty(settings.HostName))
            {
                throw new ArgumentNullException(nameof(settings.HostName));
            }
            if (container == null)
            {
                throw new ArgumentNullException(nameof(container));
            }
            if (requestOptionsFactory == null)
            {
                throw new ArgumentException(nameof(requestOptionsFactory));
            }
            if (leaseUpdater == null)
            {
                throw new ArgumentException(nameof(leaseUpdater));
            }

            this.leaseStore = new DocumentServiceLeaseStoreCosmos(
                container,
                settings.ContainerNamePrefix,
                requestOptionsFactory);

            this.leaseManager = new DocumentServiceLeaseManagerCosmos(
                container,
                leaseUpdater,
                settings,
                requestOptionsFactory);

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

            this.leaseContainer = new DocumentServiceLeaseContainerCosmos(
                container,
                settings);
        }