This PR adds protected virtual methods to RawKeyValueStore<T> that are called when compressing/decompressing raw values. It also adds IsGzipped methods to KeyValueStore that look for the gzip magic bytes (0x1F, 0x8B) at the start of an array or stream.
The purpose of these changes is to allow for situations where a RawKeyValueStore<T> implementation retrieves bytes from an external source that may not be compressed. RawKeyValueStore<T> always assumes that raw byte values being read from the store are compressed, since it always compresses bytes when they are written to the store. However, if an implementation received raw bytes from an external service and those raw bytes were not compressed, an exception would previously be thrown when the RawKeyValueStore<T> attempted to decompress the raw bytes.
The PR also makes minor changes to the FASTER key/value store size tracking used in metrics.
This PR adds protected virtual methods to
RawKeyValueStore<T>
that are called when compressing/decompressing raw values. It also addsIsGzipped
methods toKeyValueStore
that look for the gzip magic bytes (0x1F
,0x8B
) at the start of an array or stream.The purpose of these changes is to allow for situations where a
RawKeyValueStore<T>
implementation retrieves bytes from an external source that may not be compressed.RawKeyValueStore<T>
always assumes that raw byte values being read from the store are compressed, since it always compresses bytes when they are written to the store. However, if an implementation received raw bytes from an external service and those raw bytes were not compressed, an exception would previously be thrown when theRawKeyValueStore<T>
attempted to decompress the raw bytes.The PR also makes minor changes to the FASTER key/value store size tracking used in metrics.