RMQ - RabbitMQ C++ Library
rmqa_compressiontransformerimpl.h
1// Copyright 2025 Bloomberg Finance L.P.
2// SPDX-License-Identifier: Apache-2.0
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#ifndef INCLUDED_RMQA_COMPRESSIONTRANSFORMERIMPL
17#define INCLUDED_RMQA_COMPRESSIONTRANSFORMERIMPL
18
19#include <rmqp_messagetransformer.h>
20#include <rmqt_properties.h>
21#include <rmqt_result.h>
22
23#include <bsl_memory.h>
24#include <bsl_string.h>
25#include <bsl_vector.h>
26#include <bsls_keyword.h>
27
28struct ZSTD_CCtx_s;
29typedef struct ZSTD_CCtx_s ZSTD_CCtx;
30
31namespace BloombergLP {
32namespace rmqa {
33
35 public:
37
38 ~CompressionTransformerImpl() BSLS_KEYWORD_OVERRIDE;
39
40 rmqt::Result<bool> transform(bsl::shared_ptr<bsl::vector<uint8_t> >& data,
41 rmqt::Properties& props) BSLS_KEYWORD_OVERRIDE;
42
44 inverseTransform(bsl::shared_ptr<bsl::vector<uint8_t> >& data,
45 rmqt::Properties& props) BSLS_KEYWORD_OVERRIDE;
46
47 bsl::string name() const BSLS_KEYWORD_OVERRIDE
48 {
49 return bsl::string("compression");
50 }
51
52 private:
53 ZSTD_CCtx* zctx;
54
55 rmqt::Result<> decompressZstd(bsl::shared_ptr<bsl::vector<uint8_t> >& data,
56 size_t originalSize);
57
59 BSLS_KEYWORD_DELETED;
61 operator=(const CompressionTransformerImpl&) BSLS_KEYWORD_DELETED;
62};
63
64} // namespace rmqa
65} // namespace BloombergLP
66
67#endif
Definition: rmqa_compressiontransformerimpl.h:34
rmqt::Result< bool > transform(bsl::shared_ptr< bsl::vector< uint8_t > > &data, rmqt::Properties &props) BSLS_KEYWORD_OVERRIDE
Transform the data and properties of a message.
rmqt::Result inverseTransform(bsl::shared_ptr< bsl::vector< uint8_t > > &data, rmqt::Properties &props) BSLS_KEYWORD_OVERRIDE
Inverse transform the data and properties of a message.
Abstract class for message transformations.
Definition: rmqp_messagetransformer.h:30
A result of an operation.
Definition: rmqt_result.h:37
Properties is an minimal abstraction of the properties one can set on a message.
Definition: rmqt_properties.h:73