<commit_before>// Copyright 2020 The Measurement Proto 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 wfa.measurement.api.v1alpha;

import "wfa/measurement/api/v1alpha/requisition.proto";

option java_package = "org.wfanet.measurement.api.v1alpha";
option java_multiple_files = true;
option java_outer_classname = "GlobalComputationProto";

message GlobalComputation {
  // Resource key message.
  message Key {
    string global_computation_id = 1;
  }
  // Resource key.
  Key key = 1;

  // State that the computation can be in.
  enum State {
    // Default value if state is omitted. Should never be us
    STATE_UNSPECIFIED = 0;

    // Computation has been created and is ready to start.
    CREATED = 1;

    // The computation is waiting for Duchies to confirm that they are ready to
    // start the MPC protocol.
    CONFIRMING = 2;

    // Computation is in progress.
    RUNNING = 3;

    // Computation was previously running but has been suspended.
    SUSPENDED = 4;

    // Computation completed successfully. Terminal state.
    SUCCEEDED = 5;

    // Computation was cancelled. Terminal state.
    CANCELLED = 6;

    // Computation completed unsuccessfully. Terminal state.
    FAILED = 7;
  }
  // Current state of the computation. Output only.
  State state = 2;

  // Which MetricRequisitions are used in this computation.
  repeated MetricRequisition.Key metric_requisitions = 3;

  // TODO: add additional fields to show Duchies what to compute.

  // Set if and only if the `state` is `SUCCEEDED`.
  Result result = 4;

  message Result {
    // TODO: add fields.
  }<commit_msg>Add Result and MetricDefinition details to GlobalComputation.<commit_after>// Copyright 2020 The Measurement Proto 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 wfa.measurement.api.v1alpha;

import "wfa/measurement/api/v1alpha/requisition.proto";

option java_package = "org.wfanet.measurement.api.v1alpha";
option java_multiple_files = true;
option java_outer_classname = "GlobalComputationProto";

message GlobalComputation {
  // Resource key message.
  message Key {
    string global_computation_id = 1;
  }
  // Resource key.
  Key key = 1;

  // State that the computation can be in.
  enum State {
    // Default value if state is omitted. Should never be us
    STATE_UNSPECIFIED = 0;

    // Computation has been created and is ready to start.
    CREATED = 1;

    // The computation is waiting for Duchies to confirm that they are ready to
    // start the MPC protocol.
    CONFIRMING = 2;

    // Computation is in progress.
    RUNNING = 3;

    // Computation was previously running but has been suspended.
    SUSPENDED = 4;

    // Computation completed successfully. Terminal state.
    SUCCEEDED = 5;

    // Computation was cancelled. Terminal state.
    CANCELLED = 6;

    // Computation completed unsuccessfully. Terminal state.
    FAILED = 7;
  }
  // Current state of the computation. Output only.
  State state = 2;

  // Which MetricRequisitions are used in this computation.
  repeated MetricRequisition.Key metric_requisitions = 3;

  // All of the `metric_requisitions` are guaranteed to have an identical
  // metric definition to this:
  MetricDefinition metric_definition = 4;

  // Set if and only if the `state` is `SUCCEEDED`.
  Result result = 5;

  // Individual result values are set only if they are required to be computed
  // by `metric_definition`.
  message Result {
    int64 reach = 1;

    // Histogram: maps frequencies to counts. For example, a map entry
    // {key: 4 value: 7} means that 7 users were exposed 4 times.
    map<int64, int64> frequency = 2;
  }
{'fraction_non_alphanumeric': 0.08098367606529575, 'fraction_numerical': 0.013355946576213695, 'mean_word_length': 3.022165387894288, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1463903', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1301, 'n_words': 556}