summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.h
diff options
context:
space:
mode:
authorW. Felix Handte <w@felixhandte.com>2018-04-20 18:52:13 (GMT)
committerW. Felix Handte <w@felixhandte.com>2018-04-20 18:59:34 (GMT)
commitd7347f9eeaffe5351886b6174f9974bd541b9b7d (patch)
tree32aeb9a6efdd431fdaa9a6f4c9967aaf1be9b7d6 /lib/lz4hc.h
parentca833f928f64d0b88fbfd2a8a8bc11b8333e487d (diff)
downloadlz4-d7347f9eeaffe5351886b6174f9974bd541b9b7d.zip
lz4-d7347f9eeaffe5351886b6174f9974bd541b9b7d.tar.gz
lz4-d7347f9eeaffe5351886b6174f9974bd541b9b7d.tar.bz2
Add API for Attaching Dictionaries
Diffstat (limited to 'lib/lz4hc.h')
-rw-r--r--lib/lz4hc.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/lz4hc.h b/lib/lz4hc.h
index cfc5d9e..fb8397e 100644
--- a/lib/lz4hc.h
+++ b/lib/lz4hc.h
@@ -279,5 +279,32 @@ void LZ4_resetStreamHC_fast(LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLeve
int LZ4_compress_HC_extStateHC_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel);
+/*! LZ4_attach_HC_dictionary() :
+ * This is an experimental API that allows for the efficient use of a
+ * static dictionary many times.
+ *
+ * Rather than re-loading the dictionary buffer into a working context before
+ * each compression, or copying a pre-loaded dictionary's LZ4_streamHC_t into a
+ * working LZ4_streamHC_t, this function introduces a no-copy setup mechanism,
+ * in which the working stream references the dictionary stream in-place.
+ *
+ * Several assumptions are made about the state of the dictionary stream.
+ * Currently, only streams which have been prepared by LZ4_loadDictHC() should
+ * be expected to work.
+ *
+ * Alternatively, the provided dictionary stream pointer may be NULL, in which
+ * case any existing dictionary stream is unset.
+ *
+ * A dictionary should only be attached to a stream without any history (i.e.,
+ * a stream that has just been reset).
+ *
+ * The dictionary will remain attached to the working stream only for the
+ * current stream session. Calls to LZ4_resetStreamHC(_fast) will remove the
+ * dictionary context association from the working stream. The dictionary
+ * stream (and source buffer) must remain in-place / accessible / unchanged
+ * through the lifetime of the stream session.
+ */
+LZ4LIB_API void LZ4_attach_HC_dictionary(LZ4_streamHC_t *working_stream, const LZ4_streamHC_t *dictionary_stream);
+
#endif /* LZ4_HC_SLO_098092834 */
#endif /* LZ4_HC_STATIC_LINKING_ONLY */