|
| 1 | +// Copyright 2023 Google LLC |
| 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 | +// https://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 | + |
| 15 | +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_NOOP_MESSAGE_BATCH_H |
| 16 | +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_NOOP_MESSAGE_BATCH_H |
| 17 | + |
| 18 | +#include "google/cloud/pubsub/internal/message_batch.h" |
| 19 | + |
| 20 | +namespace google { |
| 21 | +namespace cloud { |
| 22 | +namespace pubsub_internal { |
| 23 | +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN |
| 24 | + |
| 25 | +/** |
| 26 | + * A no-op implementation of `MessageBatch` |
| 27 | + */ |
| 28 | +class NoOpMessageBatch : public MessageBatch { |
| 29 | + public: |
| 30 | + NoOpMessageBatch() = default; |
| 31 | + |
| 32 | + ~NoOpMessageBatch() override = default; |
| 33 | + |
| 34 | + void SaveMessage(pubsub::Message m) override{}; |
| 35 | + |
| 36 | + void Flush() override{}; |
| 37 | + |
| 38 | + void FlushCallback() override{}; |
| 39 | +}; |
| 40 | + |
| 41 | +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END |
| 42 | +} // namespace pubsub_internal |
| 43 | +} // namespace cloud |
| 44 | +} // namespace google |
| 45 | + |
| 46 | +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUB_INTERNAL_NOOP_MESSAGE_BATCH_H |
0 commit comments