// Copyright 2025 Envoy Project Authors
//
// 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
// 
//     http://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.

syntax = "proto3";

package envoy.extensions.common.async_files.v3;

import "xds/annotations/v3/status.proto";

import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.common.async_files.v3";
option java_outer_classname = "AsyncFileManagerProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/common/async_files/v3;async_filesv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
option (xds.annotations.v3.file_status).work_in_progress = true;

// [#protodoc-title: AsyncFileManager configuration]

// Configuration to instantiate or select a singleton ``AsyncFileManager``.
message AsyncFileManagerConfig {
  message ThreadPool {
    // The number of threads to use. If unset or zero, will default to the number
    // of concurrent threads the hardware supports. This default is subject to
    // change if performance analysis suggests it.
    uint32 thread_count = 1 [(validate.rules).uint32 = {lte: 1024}];
  }

  // An optional identifier for the manager. An empty string is a valid identifier
  // for a common, default ``AsyncFileManager``.
  //
  // Reusing the same id with different configurations in the same envoy instance
  // is an error.
  string id = 1;

  oneof manager_type {
    option (validate.required) = true;

    // Configuration for a thread-pool based async file manager.
    ThreadPool thread_pool = 2;
  }
}
