kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/proto/xref_serving.proto (about)

     1  /*
     2   * Copyright 2018 The Kythe Authors. All rights reserved.
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *   http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  syntax = "proto3";
    18  
    19  package kythe.proto.serving.xrefs;
    20  
    21  option go_package = "kythe.io/kythe/proto/xref_serving_go_proto";
    22  option java_package = "com.google.devtools.kythe.proto";
    23  
    24  import "kythe/proto/common.proto";
    25  import "kythe/proto/schema.proto";
    26  import "kythe/proto/serving.proto";
    27  import "kythe/proto/storage.proto";
    28  
    29  // Columnar protocol buffer format for FileDecorations.
    30  //
    31  // Design: https://github.com/kythe/kythe/blob/master/kythe/docs/rfc/2909.md
    32  //
    33  // Columnar key prefix: "fd"-file
    34  message FileDecorations {
    35    kythe.proto.VName file = 1;
    36  
    37    oneof entry {
    38      Index index = 2;
    39      Text text = 3;
    40      Target target = 4;
    41      TargetOverride target_override = 5;
    42      TargetNode target_node = 6;
    43      TargetDefinition target_definition = 7;
    44      DefinitionLocation definition_location = 8;
    45      Override override = 9;
    46      Diagnostic diagnostic = 10;
    47    }
    48  
    49    // Index for columnar file decorations data.
    50    //
    51    // Columnar key: <empty>
    52    message Index {
    53      string text_encoding = 1;
    54    }
    55  
    56    // File contents (possibly partial) for FileDecorations.
    57    //
    58    // Columnar key: 00-start-end
    59    message Text {
    60      // Starting offset of this file contents piece.
    61      int32 start_offset = 1;
    62      // Ending offset of this file contents piece.
    63      int32 end_offset = 2;
    64  
    65      bytes text = 3;
    66    }
    67  
    68    // File decoration target
    69    //
    70    // Columnar key: 10-build_config-start-end-kind-target
    71    message Target {
    72      // Starting offset of this file decoration.
    73      int32 start_offset = 1;
    74      // Ending offset of this file decoration.
    75      int32 end_offset = 2;
    76  
    77      oneof kind {
    78        kythe.proto.schema.EdgeKind kythe_kind = 3;
    79        string generic_kind = 4;
    80      }
    81  
    82      kythe.proto.VName target = 5;
    83  
    84      string build_config = 6;
    85    }
    86  
    87    // Override per file decoration target node.
    88    //
    89    // Columnar key: 20-target-kind-override
    90    message TargetOverride {
    91      // File decorations target node marked as overridden.
    92      kythe.proto.VName overridden = 1;
    93      kythe.proto.serving.FileDecorations.Override.Kind kind = 2;
    94      // Node that overrides the file decoration target node.
    95      kythe.proto.VName overriding = 3;
    96      kythe.proto.serving.ExpandedAnchor overriding_definition = 4;
    97    }
    98  
    99    // File decorations target node.
   100    //
   101    // Columnar key: 30-target
   102    message TargetNode {
   103      kythe.proto.schema.Node node = 1;
   104    }
   105  
   106    // File decorations target node definition.
   107    //
   108    // Columnar key: 40-target
   109    message TargetDefinition {
   110      kythe.proto.VName target = 1;
   111      kythe.proto.VName definition = 2;
   112    }
   113  
   114    // Location for each node mentioned by a TargetDefinition
   115    //
   116    // Columnar key: 50-definition
   117    message DefinitionLocation {
   118      kythe.proto.serving.ExpandedAnchor location = 1;
   119    }
   120  
   121    // Override data for each overriding node mentioned in a TargetOverride.
   122    //
   123    // Columnar key: 60-override
   124    message Override {
   125      kythe.proto.VName override = 1;
   126      kythe.proto.common.MarkedSource marked_source = 2;
   127    }
   128  
   129    // Diagnostic per file span
   130    //
   131    // Columnar key: 70-start-end-hash
   132    // TODO(schroederc): add build_config to spanning Diagnostics and key
   133    message Diagnostic {
   134      kythe.proto.common.Diagnostic diagnostic = 1;
   135    }
   136  }
   137  
   138  // Columnar protocol buffer format for CrossReferences.
   139  //
   140  // Design: https://github.com/kythe/kythe/blob/master/kythe/docs/rfc/2909.md
   141  //
   142  // Columnar key prefix: "xr"-source
   143  message CrossReferences {
   144    kythe.proto.VName source = 1;
   145  
   146    oneof entry {
   147      Index index = 2;
   148      Reference reference = 3;
   149      Relation relation = 4;
   150      Caller caller = 5;
   151      Callsite callsite = 6;
   152      RelatedNode related_node = 7;
   153      NodeDefinition node_definition = 8;
   154    }
   155  
   156    // Index for columnar cross-references data.
   157    //
   158    // Columnar key: <empty>
   159    message Index {
   160      kythe.proto.schema.Node node = 1;
   161      kythe.proto.common.MarkedSource marked_source = 2;
   162      repeated kythe.proto.VName merge_with = 3;
   163    }
   164  
   165    // Single reference to source.
   166    //
   167    // Columnar key: 00-kind-file-start-end
   168    message Reference {
   169      oneof kind {
   170        kythe.proto.schema.EdgeKind kythe_kind = 1;
   171        string generic_kind = 2;
   172      }
   173      kythe.proto.serving.ExpandedAnchor location = 3;
   174  
   175      // TODO(schroederc): add priority grouping
   176    }
   177  
   178    // Single edge relation to the source node.
   179    //
   180    // Columnar key: 10-kind-reverse-ordinal-target
   181    message Relation {
   182      // Target node of the relation
   183      kythe.proto.VName node = 1;
   184      // Relation to the node.
   185      oneof kind {
   186        kythe.proto.schema.EdgeKind kythe_kind = 2;
   187        string generic_kind = 3;
   188      }
   189      // Edge ordinal for this relation to the node.
   190      int32 ordinal = 4;
   191      // Whether the relation is a reverse edge.
   192      bool reverse = 5;
   193  
   194      // TODO(schroederc): add priority grouping
   195    }
   196  
   197    // A caller with callsites to the source node.
   198    //
   199    // Columnar key: 20-caller
   200    message Caller {
   201      kythe.proto.VName caller = 1;
   202      // Syntactic location of the caller.
   203      kythe.proto.serving.ExpandedAnchor location = 2;
   204      // MarkedSource of the caller.
   205      kythe.proto.common.MarkedSource marked_source = 3;
   206    }
   207  
   208    // A single callsite to the source node.
   209    //
   210    // Columnar key: 20-caller-kind-file-start-end
   211    message Callsite {
   212      kythe.proto.VName caller = 1;
   213      // Syntactic location of the callsite.
   214      kythe.proto.serving.ExpandedAnchor location = 2;
   215      Kind kind = 3;
   216  
   217      enum Kind {
   218        UNKNOWN = 0;
   219        DIRECT = 1;
   220        OVERRIDE = 2;
   221      }
   222    }
   223  
   224    // Node data for relations.
   225    //
   226    // Columnar key: 30-node
   227    message RelatedNode {
   228      kythe.proto.schema.Node node = 1;
   229    }
   230  
   231    // Definition location for each RelatedNode
   232    //
   233    // Columnar key: 40-node
   234    message NodeDefinition {
   235      kythe.proto.VName node = 1;
   236      kythe.proto.serving.ExpandedAnchor location = 2;
   237    }
   238  }