vitess.io/vitess@v0.16.2/proto/vtrpc.proto (about)

     1  /*
     2  Copyright 2019 The Vitess Authors.
     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  // This file contains useful data structures for RPCs in Vitess.
    18  
    19  syntax = "proto3";
    20  option go_package = "vitess.io/vitess/go/vt/proto/vtrpc";
    21  
    22  option java_package="io.vitess.proto";
    23  
    24  package vtrpc;
    25  
    26  // CallerID is passed along RPCs to identify the originating client
    27  // for a request. It is not meant to be secure, but only
    28  // informational.  The client can put whatever info they want in these
    29  // fields, and they will be trusted by the servers. The fields will
    30  // just be used for logging purposes, and to easily find a client.
    31  // VtGate propagates it to VtTablet, and VtTablet may use this
    32  // information for monitoring purposes, to display on dashboards, or
    33  // for denying access to tables during a migration.
    34  message CallerID {
    35    // principal is the effective user identifier. It is usually filled in
    36    // with whoever made the request to the appserver, if the request
    37    // came from an automated job or another system component.
    38    // If the request comes directly from the Internet, or if the Vitess client
    39    // takes action on its own accord, it is okay for this field to be absent.
    40    string principal = 1;
    41  
    42    // component describes the running process of the effective caller.
    43    // It can for instance be the hostname:port of the servlet initiating the
    44    // database call, or the container engine ID used by the servlet.
    45    string component = 2;
    46  
    47    // subcomponent describes a component inisde the immediate caller which
    48    // is responsible for generating is request. Suggested values are a
    49    // servlet name or an API endpoint name.
    50    string subcomponent = 3;
    51  
    52    // set of security groups that should be assigned to this caller.
    53    repeated string groups = 4;
    54  }
    55  
    56  // Code represents canonical error codes. The names, numbers and comments
    57  // must match the ones defined by grpc (0-16):
    58  //   https://godoc.org/google.golang.org/grpc/codes.
    59  // 17+ are custom codes
    60  enum Code {
    61    // OK is returned on success.
    62    OK = 0;
    63  
    64    // CANCELED indicates the operation was cancelled (typically by the caller).
    65    CANCELED = 1;
    66  
    67    // UNKNOWN error. An example of where this error may be returned is
    68    // if a Status value received from another address space belongs to
    69    // an error-space that is not known in this address space. Also
    70    // errors raised by APIs that do not return enough error information
    71    // may be converted to this error.
    72    UNKNOWN = 2;
    73  
    74    // INVALID_ARGUMENT indicates client specified an invalid argument.
    75    // Note that this differs from FAILED_PRECONDITION. It indicates arguments
    76    // that are problematic regardless of the state of the system
    77    // (e.g., a malformed file name).
    78    INVALID_ARGUMENT = 3;
    79  
    80    // DEADLINE_EXCEEDED means operation expired before completion.
    81    // For operations that change the state of the system, this error may be
    82    // returned even if the operation has completed successfully. For
    83    // example, a successful response from a server could have been delayed
    84    // long enough for the deadline to expire.
    85    DEADLINE_EXCEEDED = 4;
    86  
    87    // NOT_FOUND means some requested entity (e.g., file or directory) was
    88    // not found.
    89    NOT_FOUND = 5;
    90  
    91    // ALREADY_EXISTS means an attempt to create an entity failed because one
    92    // already exists.
    93    ALREADY_EXISTS = 6;
    94  
    95    // PERMISSION_DENIED indicates the caller does not have permission to
    96    // execute the specified operation. It must not be used for rejections
    97    // caused by exhausting some resource (use RESOURCE_EXHAUSTED
    98    // instead for those errors).  It must not be
    99    // used if the caller cannot be identified (use Unauthenticated
   100    // instead for those errors).
   101    PERMISSION_DENIED = 7;
   102  
   103  
   104    // RESOURCE_EXHAUSTED indicates some resource has been exhausted, perhaps
   105    // a per-user quota, or perhaps the entire file system is out of space.
   106    RESOURCE_EXHAUSTED = 8;
   107  
   108    // FAILED_PRECONDITION indicates operation was rejected because the
   109    // system is not in a state required for the operation's execution.
   110    // For example, directory to be deleted may be non-empty, an rmdir
   111    // operation is applied to a non-directory, etc.
   112    //
   113    // A litmus test that may help a service implementor in deciding
   114    // between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
   115    //  (a) Use UNAVAILABLE if the client can retry just the failing call.
   116    //  (b) Use ABORTED if the client should retry at a higher-level
   117    //      (e.g., restarting a read-modify-write sequence).
   118    //  (c) Use FAILED_PRECONDITION if the client should not retry until
   119    //      the system state has been explicitly fixed.  E.g., if an "rmdir"
   120    //      fails because the directory is non-empty, FAILED_PRECONDITION
   121    //      should be returned since the client should not retry unless
   122    //      they have first fixed up the directory by deleting files from it.
   123    //  (d) Use FAILED_PRECONDITION if the client performs conditional
   124    //      REST Get/Update/Delete on a resource and the resource on the
   125    //      server does not match the condition. E.g., conflicting
   126    //      read-modify-write on the same resource.
   127    FAILED_PRECONDITION = 9;
   128  
   129    // ABORTED indicates the operation was aborted, typically due to a
   130    // concurrency issue like sequencer check failures, transaction aborts,
   131    // etc.
   132    //
   133    // See litmus test above for deciding between FAILED_PRECONDITION,
   134    // ABORTED, and UNAVAILABLE.
   135    ABORTED = 10;
   136  
   137    // OUT_OF_RANGE means operation was attempted past the valid range.
   138    // E.g., seeking or reading past end of file.
   139    //
   140    // Unlike INVALID_ARGUMENT, this error indicates a problem that may
   141    // be fixed if the system state changes. For example, a 32-bit file
   142    // system will generate INVALID_ARGUMENT if asked to read at an
   143    // offset that is not in the range [0,2^32-1], but it will generate
   144    // OUT_OF_RANGE if asked to read from an offset past the current
   145    // file size.
   146    //
   147    // There is a fair bit of overlap between FAILED_PRECONDITION and
   148    // OUT_OF_RANGE.  We recommend using OUT_OF_RANGE (the more specific
   149    // error) when it applies so that callers who are iterating through
   150    // a space can easily look for an OUT_OF_RANGE error to detect when
   151    // they are done.
   152    OUT_OF_RANGE = 11;
   153  
   154    // UNIMPLEMENTED indicates operation is not implemented or not
   155    // supported/enabled in this service.
   156    UNIMPLEMENTED = 12;
   157  
   158    // INTERNAL errors. Means some invariants expected by underlying
   159    // system has been broken.  If you see one of these errors,
   160    // something is very broken.
   161    INTERNAL = 13;
   162  
   163    // UNAVAILABLE indicates the service is currently unavailable.
   164    // This is a most likely a transient condition and may be corrected
   165    // by retrying with a backoff.
   166    //
   167    // See litmus test above for deciding between FAILED_PRECONDITION,
   168    // ABORTED, and UNAVAILABLE.
   169    UNAVAILABLE = 14;
   170  
   171    // DATA_LOSS indicates unrecoverable data loss or corruption.
   172    DATA_LOSS = 15;
   173  
   174    // UNAUTHENTICATED indicates the request does not have valid
   175    // authentication credentials for the operation.
   176    UNAUTHENTICATED = 16;
   177  
   178    // CLUSTER_EVENT indicates that a cluster operation might be in effect
   179    CLUSTER_EVENT = 17;
   180  
   181    // Topo server connection is read-only
   182    READ_ONLY = 18;
   183  }
   184  
   185  // RPCError is an application-level error structure returned by
   186  // VtTablet (and passed along by VtGate if appropriate).
   187  // We use this so the clients don't have to parse the error messages,
   188  // but instead can depend on the value of the code.
   189  message RPCError {
   190    reserved 1; reserved "legacy_code";
   191    string message = 2;
   192    Code code = 3;
   193  }