-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xds: define base interfaces for filter factories (#9391)
Introduces a typed factory and an untyped factory as base types for all extension factories. Code refactor to facilitate using the config type as the primary selection mechanism for an extension. This change should not cause any behavioral change. The actual switch is in a follow-up PR. Contributes to: #9358 Risk Level: low Testing: existing tests pass Docs Changes: Release Notes: Signed-off-by: Kuat Yessenov <[email protected]>
- Loading branch information
Showing
120 changed files
with
359 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#pragma once | ||
|
||
#include "envoy/common/pure.h" | ||
|
||
#include "common/common/assert.h" | ||
#include "common/protobuf/protobuf.h" | ||
|
||
namespace Envoy { | ||
namespace Config { | ||
|
||
/** | ||
* Base class for an extension factory. | ||
*/ | ||
class UntypedFactory { | ||
public: | ||
virtual ~UntypedFactory() = default; | ||
|
||
/** | ||
* Name of the factory, a reversed DNS name is encouraged to avoid cross-org conflict. | ||
* It's used as key in the metadata map, as well as key in the factory registry. | ||
*/ | ||
virtual std::string name() const PURE; | ||
|
||
/** | ||
* @return std::string the identifying category name for objects | ||
* created by this factory. Used for automatic registration with | ||
* FactoryCategoryRegistry. | ||
*/ | ||
virtual std::string category() const PURE; | ||
|
||
/** | ||
* @return configuration proto full name, or empty for untyped factories. | ||
*/ | ||
virtual std::string configType() { return ""; } | ||
}; | ||
|
||
/** | ||
* Base class for an extension factory configured by a typed proto message. | ||
*/ | ||
class TypedFactory : public UntypedFactory { | ||
public: | ||
virtual ~TypedFactory() = default; | ||
|
||
/** | ||
* @return ProtobufTypes::MessagePtr create empty config proto message for v2. The config, which | ||
* arrives in an opaque google.protobuf.Struct message, will be converted to JSON and then parsed | ||
* into this empty proto. | ||
*/ | ||
virtual ProtobufTypes::MessagePtr createEmptyConfigProto() PURE; | ||
|
||
std::string configType() override { | ||
auto ptr = createEmptyConfigProto(); | ||
ASSERT(ptr != nullptr); | ||
return ptr->GetDescriptor()->full_name(); | ||
} | ||
}; | ||
|
||
} // namespace Config | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.