ext_decompressor.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2023 EMQ Technologies Co., Ltd.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //go:build compression || !core
  15. package compressor
  16. import (
  17. "github.com/lf-edge/ekuiper/internal/compressor/flate"
  18. "github.com/lf-edge/ekuiper/internal/compressor/gzip"
  19. "github.com/lf-edge/ekuiper/internal/compressor/zlib"
  20. "github.com/lf-edge/ekuiper/internal/compressor/zstd"
  21. "github.com/lf-edge/ekuiper/pkg/message"
  22. )
  23. func init() {
  24. decompressors[ZLIB] = func(name string) (message.Decompressor, error) {
  25. return zlib.NewZlibDecompressor()
  26. }
  27. decompressors[GZIP] = func(name string) (message.Decompressor, error) {
  28. return gzip.NewGzipDecompressor()
  29. }
  30. decompressors[FLATE] = func(name string) (message.Decompressor, error) {
  31. return flate.NewFlateDecompressor()
  32. }
  33. decompressors[ZSTD] = func(name string) (message.Decompressor, error) {
  34. return zstd.NewzstdDecompressor()
  35. }
  36. decompressReaders[GZIP] = gzip.NewReader
  37. decompressReaders[ZSTD] = zstd.NewReader
  38. }