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(); }
public ChunkData GetChunkDataFromFileSystem(string chunkHash) { return(ChunkData.FromChunk(FileSystemChunkStorage.GetChunk(chunkHash))); }