예제 #1
0
        public FileService(IRepository repository, DataSettings dataSettings = null, ILogger logger = null)
        {
            Repository = repository;
            Repository.AddTypes(new Type[]
            {
                typeof(ChunkedFileDescriptor),
                typeof(ChunkDataDescriptor),
                typeof(ChunkData)
            });
            DataSettings           = dataSettings ?? DataSettings.Default;
            Logger                 = logger ?? Log.Default;
            FileSystemChunkStorage = new FileSystemChunkStorage(DataSettings, Logger);
            RepositoryChunkStorage = new RepositoryChunkStorage(Repository, DataSettings, Logger);
            ChunkStorage           = new CompositeChunkStorage();
            ChunkStorage.AddStorage(FileSystemChunkStorage);
            ChunkStorage.AddStorage(RepositoryChunkStorage);

            ChunkDataBatchSize = 10;
            ChunkLength        = 256000;
            ChunkDirectory     = DataSettings.GetChunksDirectory().FullName;
            SetChunkDataDescriptorRetriever();
        }
예제 #2
0
        private string GetChunkDirectoryPath(string hash)
        {
            DirectoryInfo chunksDir = DataSettings.GetChunksDirectory();

            return(Path.Combine(chunksDir.FullName, Path.Combine(hash.SplitByLength(2).ToArray())));
        }