Beispiel #1
0
        private IEntity LoadEntity(IReadableAttributeStorage storage, string path)
        {
            try
            {
                return(storage.Load(path));
            }
            catch (InvalidDataFormatException e)
            {
                Logger.Debug(e, "SELECT \"{0}\"", _fileFinder.Pattern);
            }
            catch (PathTooLongException e)
            {
                Logger.Debug(e, "SELECT \"{0}\"", _fileFinder.Pattern);
            }
            catch (ArgumentException e)
            {
                Logger.Error(e, "SELECT \"{0}\"", _fileFinder.Pattern);
            }
            catch (IOException e)
            {
                Logger.Debug(e);
            }
            catch (Exception e) when(e.GetType() == typeof(UnauthorizedAccessException) ||
                                     e.GetType() == typeof(SecurityException))
            {
                // skip these
            }

            return(null);
        }
Beispiel #2
0
        private IEntity GetEntityImpl(IReadableAttributeStorage storage, string path)
        {
            var normalizedPath = PathUtils.NormalizePath(path);

            lock (_modified)
            {
                if (_modified.TryGetValue(normalizedPath, out var proxy))
                {
                    return(proxy.Entity);
                }
            }

            return(storage.Load(path));
        }
        private IEntity LoadImpl(
            IReadableAttributeStorage persistentStorage,
            IReadableAttributeStorage cacheStorage,
            string path)
        {
            // try to load the entity from cache storage
            var entity = cacheStorage.Load(path);

            if (entity == null)
            {
                // try to load the entity from the main storage
                entity = persistentStorage.Load(path);
                if (entity != null)
                {
                    _cacheStorage.Store(entity);
                }
            }

            Notify();

            return(entity);
        }
Beispiel #4
0
 public ReadableStorageProxy(IReadableAttributeStorage storage)
 {
     _storage = storage ?? throw new ArgumentNullException(nameof(storage));
 }
 public CachedReader(CachedAttributeStorage storage)
 {
     _persistentReader = storage._persistentStorage.CreateReader();
     _cacheReader      = storage._cacheStorage.CreateReader();
     _storage          = storage;
 }
Beispiel #6
0
 public Reader(EntityManager entityManager, IReadableAttributeStorage reader)
 {
     _entityManager = entityManager;
     _reader        = reader;
 }