public SkyIslandMapImagesPhase( IStageIdentity stageIdentity, IStageBounds stageBounds, IAsyncFactory <ChunkOverheadKey, IDisposableValue <IReadOnlySkyIslandMapChunk> > chunkFactory, IKeyValueStore statsStore, SkyIslandMapImagesOptions imageOptions = null, GenerationOptions generationOptions = null) { Contracts.Requires.That(stageIdentity != null); Contracts.Requires.That(stageBounds != null); Contracts.Requires.That(chunkFactory != null); Contracts.Requires.That(statsStore != null); var phaseIdentity = new GenerationPhaseIdentity(nameof(SkyIslandMapImagesPhase)); var chunkKeys = new ChunkOverheadKeyCollection(stageBounds); var chunkProcessor = new SkyIslandMapChunkImagesProcessor(stageBounds, statsStore, imageOptions); this.Phase = new ChunkedPhase <ChunkOverheadKey, IReadOnlySkyIslandMapChunk>( stageIdentity, phaseIdentity, chunkKeys, chunkFactory, chunkProcessor, generationOptions); }
public SkyIslandMapAbsolutePhase( IStageIdentity stageIdentity, IStageBounds stageBounds, IRasterChunkConfig <Index2D> chunkConfig, IAsyncChunkPopulator <ISkyIslandMapChunk> chunkPopulator, IChunkStore <ChunkOverheadKey, SerializedSkyIslandMapChunk> chunkStore, int maxBufferedChunks, BatchSerializeGenerationOptions options = null) { Contracts.Requires.That(stageIdentity != null); Contracts.Requires.That(stageBounds != null); Contracts.Requires.That(chunkConfig != null); Contracts.Requires.That(chunkPopulator != null); Contracts.Requires.That(chunkStore != null); Contracts.Requires.That(maxBufferedChunks > 0); var phaseIdentity = new GenerationPhaseIdentity(nameof(SkyIslandMapAbsolutePhase)); var chunkKeys = new ChunkOverheadKeyCollection(stageBounds); var poolOptions = new PoolOptions <SkyIslandMapChunkResources>() { }; this.pool = Pool.WithFactory.New(new SkyIslandMapChunkResourcesFactory(chunkConfig), poolOptions); var chunkFactory = new SkyIslandMapChunkPoolingFactory(this.pool, chunkPopulator); var serializer = new SkyIslandMapChunkResourcesSerializer( SkyIslandMapsSerializer.Get[options?.SerializationEndianness ?? DefaultSerializationEndianness], chunkConfig); var persister = new SkyIslandMapChunkPersister(serializer); var persistableFactory = ChunkFactory.Persister.Create(chunkFactory, persister); this.Phase = new ChunkedBatchingPhase <ChunkOverheadKey, SerializedSkyIslandMapChunk>( stageIdentity, phaseIdentity, chunkKeys, persistableFactory, chunkStore, maxBufferedChunks, options); this.Completion = this.CompleteAsync(); }