| // Copyright 2026 Google LLC | |
| // | |
| // Licensed under the Apache License, Version 2.0 (the "License"); | |
| // you may not use this file except in compliance with the License. | |
| // You may obtain a copy of the License at | |
| // | |
| // https://www.apache.org/licenses/LICENSE-2.0 | |
| // | |
| // Unless required by applicable law or agreed to in writing, software | |
| // distributed under the License is distributed on an "AS IS" BASIS, | |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| // See the License for the specific language governing permissions and | |
| // limitations under the License. | |
| // | |
| #ifndef THIRD_PARTY_CREDENTIO_VALIDATOR_ASSET_VALIDATOR_IMPL_H_ | |
| #define THIRD_PARTY_CREDENTIO_VALIDATOR_ASSET_VALIDATOR_IMPL_H_ | |
| #include <cstdint> | |
| #include <memory> | |
| #include <optional> | |
| #include "absl/base/nullability.h" | |
| #include "absl/status/statusor.h" | |
| #include "absl/strings/string_view.h" | |
| #include "formats/registry.h" | |
| #include "riegeli/bytes/reader.h" | |
| #include "validator/asset_validator.h" | |
| #include "validator/manifest_store_validator.h" | |
| #include "validator/result.h" | |
| #include "validator/validator_metrics.h" | |
| #include "validator/validator_options.h" | |
| namespace credentio { | |
| class AssetValidatorImpl : public AssetValidator { | |
| public: | |
| explicit AssetValidatorImpl(ValidatorOptions options); | |
| absl::StatusOr<std::unique_ptr<ValidationResult>> Validate( | |
| riegeli::Reader& input, | |
| std::optional<absl::string_view> media_type) const override; | |
| private: | |
| struct Options { | |
| int64_t max_chunk_bytes; | |
| ValidatorMetrics* absl_nullable metrics; | |
| explicit Options(const ValidatorOptions& options) | |
| : max_chunk_bytes(options.max_chunk_bytes), metrics(options.metrics) {} | |
| }; | |
| Options options_; | |
| std::unique_ptr<FormatRegistry> format_registry_; | |
| std::unique_ptr<ManifestStoreValidator> manifest_store_validator_; | |
| }; | |
| } // namespace credentio | |
| #endif // THIRD_PARTY_CREDENTIO_VALIDATOR_ASSET_VALIDATOR_IMPL_H_ |