// M-Files Server gRPC API 26.11. Generated from the M-Files Server IDL; do not edit.
// Documentation: https://developer.m-files.com/APIs/gRPC-API/
syntax = "proto3";

package MFiles;

import "mfiles/api/annotations.proto";
import "mfiles/enums.proto";
import "mfiles/structs.proto";

option csharp_namespace = "MFiles.Grpc";
option go_package = "github.com/M-Files/mfiles-grpc-api/go/mfiles;mfiles";
option java_multiple_files = true;
option java_package = "com.mfiles.grpc";
option objc_class_prefix = "MF_";

// Reads the vault's monitoring indicators; currently the status of the search indexes.
//
// This interface provides access to vault specific monitoring indicators.
//
// M-Files Admin uses this service to show the indexing status of a vault (whether indexing or a
// rebuild is running, batch times, items processed). The only supported context is
// `MONITORING_CONTEXT_INDEXING`; other contexts fail with "Not implemented.".
//
// **Sessions and rights.** Every method requires a vault session with the vault right
// `see_all_objects` ([VaultAccess](mfiles:MFiles.VaultAccess)); vault administrators have it.
// A server-level session fails with "Login required.", a normal user with "Access denied.".
//
// Typical order: list the index sources with
// [GetIndicatorSources](mfiles:MFiles.IRPCMonitoringStatus.GetIndicatorSources), then read their
// values with [GetIndicators](mfiles:MFiles.IRPCMonitoringStatus.GetIndicators).
// [GetActiveNotifications](mfiles:MFiles.IRPCMonitoringStatus.GetActiveNotifications) gives a
// quick summary as flags.
service IRPCMonitoringStatus {
	option (mfiles.api.service) = { book: "admin" level: LEVEL_SPECIALIZED title: "Monitoring status" };

	// Lists the monitoring sources of the vault, for indexing one source per index and partition.
	//
	// - Requires a vault session with the vault right `see_all_objects`.
	// - `context` must be `MONITORING_CONTEXT_INDEXING`; unset fails with "Not implemented.".
	// - Each source is described by tagged values; for indexing the tags are `index`, `shared`,
	//   `auxiliaryIndexID` and `partition`.
	rpc GetIndicatorSources( GetIndicatorSourcesRequest ) returns ( GetIndicatorSourcesResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION };
	}

	// Gets the indicator values of the vault's monitoring sources, optionally for one source.
	//
	// - Requires a vault session with the vault right `see_all_objects`.
	// - `source_filter.context` must be `MONITORING_CONTEXT_INDEXING`. Descriptors you leave out
	//   match any value, so a filter with only the context returns all indexes.
	// - Each indicator is a tagged value with the time it was generated, for example
	//   `Common.rebuildInProgress` or `Normal.batchCommittedAt`.
	rpc GetIndicators( GetIndicatorsRequest ) returns ( GetIndicatorsResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION };
	}

	// Gets the active indexing notifications of the vault, such as "re-indexing required" or
	// "rebuild in progress", combined over all indexes.
	//
	// - Requires a vault session with the vault right `see_all_objects`.
	// - `context` must be `MONITORING_CONTEXT_INDEXING`; other values fail with "Not implemented.".
	rpc GetActiveNotifications( GetActiveNotificationsRequest ) returns ( GetActiveNotificationsResponse ) {
		option (mfiles.api.method) = { session: SESSION_REQUIREMENT_SESSION };
	}
}

// The request of GetIndicatorSources.
message GetIndicatorSourcesRequest {

	// Set `MONITORING_CONTEXT_INDEXING`.
	MonitoringContext context = 1;
}

// The response of GetIndicatorSources.
message GetIndicatorSourcesResponse {

	// The sources. Pass one as `source_filter` to [GetIndicators](mfiles:MFiles.IRPCMonitoringStatus.GetIndicators).
	repeated MonitoringSource sources = 1;
}

// The request of GetIndicators.
message GetIndicatorsRequest {

	// The context and, optionally, descriptors (as returned by [GetIndicatorSources](mfiles:MFiles.IRPCMonitoringStatus.GetIndicatorSources)) that select the sources.
	MonitoringSource source_filter = 1;
}

// The response of GetIndicators.
message GetIndicatorsResponse {

	// One entry per source, with its indicators.
	repeated MonitoringIndicatorData data = 1;
}

// The request of GetActiveNotifications.
message GetActiveNotificationsRequest {

	// Set `MONITORING_CONTEXT_INDEXING`.
	MonitoringContext context = 1;
}

// The response of GetActiveNotifications.
message GetActiveNotificationsResponse {

	// The bits of [INDEXNOTIFICATIONFLAGS](mfiles:MFiles.INDEXNOTIFICATIONFLAGS) as a number, ORed over all indexes: 1 re-index required (property definitions changed), 2 re-index required (language changed), 4 re-index required, 8 indexing in progress, 16 rebuild in progress, 32 active file data index required, 64 active metadata index required. 0 means no notifications.
	uint32 notifications = 1;
}
