-
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.
Merge remote-tracking branch 'upstream/master' into alts_frame_protector
- Loading branch information
Showing
211 changed files
with
1,374 additions
and
518 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
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,8 @@ | ||
load("//bazel:api_build_system.bzl", "api_proto_library_internal") | ||
|
||
licenses(["notice"]) # Apache 2 | ||
|
||
api_proto_library_internal( | ||
name = "fixed_heap", | ||
srcs = ["fixed_heap.proto"], | ||
) |
10 changes: 10 additions & 0 deletions
10
api/envoy/config/resource_monitor/fixed_heap/v2alpha/fixed_heap.proto
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,10 @@ | ||
syntax = "proto3"; | ||
|
||
package envoy.config.resource_monitor.fixed_heap.v2alpha; | ||
option go_package = "v2alpha"; | ||
|
||
message FixedHeapConfig { | ||
// Limit of the Envoy process heap size. This is used to calculate heap memory pressure which | ||
// is defined as (current heap size)/max_heap_size_bytes. | ||
uint64 max_heap_size_bytes = 1; | ||
} |
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
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,52 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
|
||
#include "envoy/common/exception.h" | ||
#include "envoy/common/pure.h" | ||
|
||
namespace Envoy { | ||
namespace Server { | ||
|
||
// Struct for reporting usage for a particular resource. | ||
struct ResourceUsage { | ||
// Fraction of (resource usage)/(resource limit). | ||
double resource_pressure_; | ||
}; | ||
|
||
class ResourceMonitor { | ||
public: | ||
virtual ~ResourceMonitor() {} | ||
|
||
/** | ||
* Notifies caller of updated resource usage. | ||
*/ | ||
class Callbacks { | ||
public: | ||
virtual ~Callbacks() {} | ||
|
||
/** | ||
* Called when the request for updated resource usage succeeds. | ||
* @param usage the updated resource usage | ||
*/ | ||
virtual void onSuccess(const ResourceUsage& usage) PURE; | ||
|
||
/** | ||
* Called when the request for updated resource usage fails. | ||
* @param error the exception caught when trying to get updated resource usage | ||
*/ | ||
virtual void onFailure(const EnvoyException& error) PURE; | ||
}; | ||
|
||
/** | ||
* Recalculate resource usage. | ||
* This must be non-blocking so if RPCs need to be made they should be | ||
* done asynchronously and invoke the callback when finished. | ||
*/ | ||
virtual void updateResourceUsage(Callbacks& callbacks) PURE; | ||
}; | ||
|
||
typedef std::unique_ptr<ResourceMonitor> ResourceMonitorPtr; | ||
|
||
} // namespace Server | ||
} // 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#pragma once | ||
|
||
#include "envoy/common/pure.h" | ||
#include "envoy/event/dispatcher.h" | ||
#include "envoy/server/resource_monitor.h" | ||
|
||
#include "common/protobuf/protobuf.h" | ||
|
||
namespace Envoy { | ||
namespace Server { | ||
namespace Configuration { | ||
|
||
class ResourceMonitorFactoryContext { | ||
public: | ||
virtual ~ResourceMonitorFactoryContext() {} | ||
|
||
/** | ||
* @return Event::Dispatcher& the main thread's dispatcher. This dispatcher should be used | ||
* for all singleton processing. | ||
*/ | ||
virtual Event::Dispatcher& dispatcher() PURE; | ||
}; | ||
|
||
/** | ||
* Implemented by each resource monitor and registered via Registry::registerFactory() | ||
* or the convenience class RegistryFactory. | ||
*/ | ||
class ResourceMonitorFactory { | ||
public: | ||
virtual ~ResourceMonitorFactory() {} | ||
|
||
/** | ||
* Create a particular resource monitor implementation. | ||
* @param config const ProtoBuf::Message& supplies the config for the resource monitor | ||
* implementation. | ||
* @param context ResourceMonitorFactoryContext& supplies the resource monitor's context. | ||
* @return ResourceMonitorPtr the resource monitor instance. Should not be nullptr. | ||
* @throw EnvoyException if the implementation is unable to produce an instance with | ||
* the provided parameters. | ||
*/ | ||
virtual ResourceMonitorPtr createResourceMonitor(const Protobuf::Message& config, | ||
ResourceMonitorFactoryContext& context) PURE; | ||
|
||
/** | ||
* @return std::string the identifying name for a particular implementation of a resource | ||
* monitor produced by the factory. | ||
*/ | ||
virtual std::string name() PURE; | ||
}; | ||
|
||
} // namespace Configuration | ||
} // namespace Server | ||
} // namespace Envoy |
Oops, something went wrong.