data source: new data source provider to support file watching (#33390)

This PR provide a common data source provider to support file watching.

For the users who don't need the file watching or don't use the file data source, if the provider is used, then only need to pay 8 additional bytes and one additional if check (holds_alternative) compare to using the directly DataSource::read().

For the users who want to use the file watching, additional file watcher and TLS slot (ThreadLocalStorage) are necessary. This is much expensive but reasonable.

Risk Level: low.
Testing: unit.
Docs Changes: n/a.
Release Notes: n/a.
Platform Specific Features: n/a.

Signed-off-by: wbpcode <wbphub@live.com>
Signed-off-by: code <wangbaiping@corp.netease.com>

Mirrored from https://github.com/envoyproxy/envoy @ 838bc86a0fe46801320eef13cc599bc80bd88d10
main
update-envoy[bot] 9 months ago
parent 604e7f5053
commit 88b51a089d
  1. 17
      envoy/config/core/v3/base.proto

@ -411,6 +411,7 @@ message WatchedDirectory {
}
// Data source consisting of a file, an inline value, or an environment variable.
// [#next-free-field: 6]
message DataSource {
option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.core.DataSource";
@ -429,6 +430,22 @@ message DataSource {
// Environment variable data source.
string environment_variable = 4 [(validate.rules).string = {min_len: 1}];
}
// Watched directory that is watched for file changes. If this is set explicitly, the file
// specified in the ``filename`` field will be reloaded when relevant file move events occur.
//
// .. note::
// This field only makes sense when the ``filename`` field is set.
//
// .. note::
// Envoy only updates when the file is replaced by a file move, and not when the file is
// edited in place.
//
// .. note::
// Not all use cases of ``DataSource`` support watching directories. It depends on the
// specific usage of the ``DataSource``. See the documentation of the parent message for
// details.
WatchedDirectory watched_directory = 5;
}
// The message specifies the retry policy of remote data source when fetching fails.

Loading…
Cancel
Save