Exemplo n.º 1
0
        /// <summary>
        /// Initializes an instance of <see cref="ContainerConfiguration"/>
        /// </summary>
        /// <param name="capCloudBlobContainerName">>The name of the CapCloudBlobContainer</param>
        /// <param name="primaryServer"></param>
        /// <param name="secondaryServer"></param>
        /// <param name="sessionState">session state of the SLAEngine. This state is used for registering, and unregistering newly added/removed replicas</param>
        private ContainerConfiguration(string capCloudBlobContainerName,
                                       string primaryServer, string secondaryServer, SessionState sessionState)
        {
            PrimaryServers          = new List <string>();
            SecondaryServers        = new List <string>();
            WriteOnlyPrimaryServers = new List <string>();
            NonReplicaServers       = new List <string>();

            SyncPeriod = new Dictionary <string, int>();

            this.Name = capCloudBlobContainerName;

            if (ConfigurationLookup.IsValidServer(primaryServer))
            {
                PrimaryServers.Add(primaryServer);
            }

            if (ConfigurationLookup.IsValidServer(secondaryServer))
            {
                SecondaryServers.Add(secondaryServer);
                SyncPeriod[secondaryServer] = ConstPool.DEFAULT_SYNC_INTERVAL;
            }

            MainPrimaryIndex = 0;
            Epoch            = 0;

            this.State = sessionState;
        }
Exemplo n.º 2
0
        public List <CloudBlobContainer> GetSecondaryContainers()
        {
            List <CloudBlobContainer> result = new List <CloudBlobContainer>();

            SecondaryServers.ForEach(s => result.Add(ConfigurationLookup.GetCloudBlobContainer(s, this.Name)));
            return(result);
        }
Exemplo n.º 3
0
 public ICloudBlob GetCloudBlob(string serverName, string blobName, bool isRead = true)
 {
     return(ConfigurationLookup.GetCloudBlob(serverName, this.Name, blobName, isRead));
 }
Exemplo n.º 4
0
 public CloudBlobContainer GetMainPrimaryContainer()
 {
     return(ConfigurationLookup.GetCloudBlobContainer(MainPrimaryServer, this.Name));
 }