Exemplo n.º 1
0
        /// <summary>
        /// Concurency unsafe
        /// </summary>
        /// <returns></returns>
        private IEnumerable <IUser> LoadUsers()
        {
            var usersContentIdentifier = _contentIdentifierGenerator.GetSystemContentIdentifier(UsersContentName);
            var serializedUsers        = _systemContainerProvider.GetSystemContainer().GetStringContent(usersContentIdentifier);

            if (string.IsNullOrEmpty(serializedUsers))
            {
                return(InitialUsers());
            }

            return(_serializer.Deserialize <IEnumerable <IUser> >(serializedUsers));
        }
        private IEnumerable <IContainerState> LoadContainerStates()
        {
            var containerStatesContentIdentifier    = _contentIdentifierGenerator.GetSystemContentIdentifier(ContainerStatesContentName);
            var serializedContainerStatesContainers = _systemContainerProvider.GetSystemContainer().GetStringContent(containerStatesContentIdentifier);

            if (string.IsNullOrEmpty(serializedContainerStatesContainers))
            {
                return(Enumerable.Empty <IContainerState>());
            }

            return(_serializer.Deserialize <IEnumerable <IContainerState> >(serializedContainerStatesContainers));
        }
Exemplo n.º 3
0
        private IEnumerable <string> LoadReadOnlySubcontainerNames(IContainer container)
        {
            var readOnlySubcontainersContentIdentifier = _contentIdentifierGenerator.GetSystemContentIdentifier(GetReadOnlySubcontainersContentName());
            var namesContainer = _systemContainerProvider.GetSystemContainer(ReadOnlySubcontainersContainerName);
            var serializedReadOnlySubcontainerNames = namesContainer.GetStringContent(readOnlySubcontainersContentIdentifier);

            if (string.IsNullOrEmpty(serializedReadOnlySubcontainerNames))
            {
                return(Enumerable.Empty <string>());
            }

            return(_serializer.Deserialize <IEnumerable <string> >(serializedReadOnlySubcontainerNames));
        }
        public ISystemContainer GetSystemContainer(string specificName = null)
        {
            var containerName = string.IsNullOrEmpty(specificName) ? SystemContainerName : SystemContainerName + "-" + specificName;

            if (_cache.TryGetValue(containerName, out var existing))
            {
                return(existing);
            }

            var result = _systemContainerProvider.GetSystemContainer(specificName);

            _cache.Add(containerName, result);

            return(result);
        }
Exemplo n.º 5
0
 private ISystemContainer GetNamesContainer(string contentsContainerName)
 {
     return(_systemContainerProvider.GetSystemContainer("names/" + contentsContainerName));
 }
Exemplo n.º 6
0
 private ISystemContainer GetCacheContainer(string containerName)
 {
     return(_systemContainerProvider.GetSystemContainer("hashes/" + containerName));
 }