/// <summary> /// Creates the decorator, wrapping the given <paramref name="innerDataBusStorage"/> /// </summary> public ZippingDataBusStorageDecorator(IDataBusStorage innerDataBusStorage, DataCompressionMode dataCompressionMode) { if (innerDataBusStorage == null) { throw new ArgumentNullException(nameof(innerDataBusStorage)); } _innerDataBusStorage = innerDataBusStorage; _dataCompressionMode = dataCompressionMode; }
/// <summary> /// Enables GZIP of the saved data bus data. Set <paramref name="dataCompressionMode"/> to control when data is gzipped - if <see cref="DataCompressionMode.Always"/> /// is selected the data will always be GZIPped, whereas selecting <see cref="DataCompressionMode.Explicit"/> makes the data be GZIPped /// only when <see cref="MetadataKeys.ContentEncoding"/> = "gzip" is detected among the metadata for the stored data. /// Please note that GZIPping the data requires that it can be fully contained in memory because the underlying streaming APIs do not support lazy-reading a /// GZIP stream. /// </summary> public static StandardConfigurer<IDataBusStorage> UseCompression(this StandardConfigurer<IDataBusStorage> configurer, DataCompressionMode dataCompressionMode) { configurer.Decorate(c => { var dataBusStorage = c.Get<IDataBusStorage>(); return new ZippingDataBusStorageDecorator(dataBusStorage, dataCompressionMode); }); return configurer; }
/// <summary> /// Creates the decorator, wrapping the given <paramref name="innerDataBusStorage"/> /// </summary> public ZippingDataBusStorageDecorator(IDataBusStorage innerDataBusStorage, DataCompressionMode dataCompressionMode) { if (innerDataBusStorage == null) throw new ArgumentNullException(nameof(innerDataBusStorage)); _innerDataBusStorage = innerDataBusStorage; _dataCompressionMode = dataCompressionMode; }
/// <summary> /// Enables GZIP of the saved data bus data. Set <paramref name="dataCompressionMode"/> to control when data is gzipped - if <see cref="DataCompressionMode.Always"/> /// is selected the data will always be GZIPped, whereas selecting <see cref="DataCompressionMode.Explicit"/> makes the data be GZIPped /// only when <see cref="MetadataKeys.ContentEncoding"/> = "gzip" is detected among the metadata for the stored data. /// Please note that GZIPping the data requires that it can be fully contained in memory because the underlying streaming APIs do not support lazy-reading a /// GZIP stream. /// </summary> public static StandardConfigurer <IDataBusStorage> UseCompression(this StandardConfigurer <IDataBusStorage> configurer, DataCompressionMode dataCompressionMode) { if (configurer == null) { throw new ArgumentNullException(nameof(configurer)); } configurer.Decorate(c => { var dataBusStorage = c.Get <IDataBusStorage>(); return(new ZippingDataBusStorageDecorator(dataBusStorage, dataCompressionMode)); }); return(configurer); }
/// <summary> /// Enables GZIP of the saved data bus data. Set <paramref name="dataCompressionMode"/> to control when data is gzipped - if <see cref="DataCompressionMode.Always"/> /// is selected the data will always be GZIPped, whereas selecting <see cref="DataCompressionMode.Explicit"/> makes the data be GZIPped /// only when <see cref="MetadataKeys.ContentEncoding"/> = "gzip" is detected among the metadata for the stored data. /// Please note that GZIPping the data requires that it can be fully contained in memory because the underlying streaming APIs do not support lazy-reading a /// GZIP stream. /// </summary> public static StandardConfigurer <IDataBusStorage> UseCompression(this StandardConfigurer <IDataBusStorage> configurer, DataCompressionMode dataCompressionMode) { configurer.Decorate(c => { var dataBusStorage = c.Get <IDataBusStorage>(); return(new ZippingDataBusStorageDecorator(dataBusStorage, dataCompressionMode)); }); return(configurer); }