github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvnemesis/operations.proto (about)

     1  // Copyright 2020 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  syntax = "proto3";
    12  package cockroach.kv.kvnemesis;
    13  option go_package = "kvnemesis";
    14  
    15  import "errorspb/errors.proto";
    16  import "gogoproto/gogo.proto";
    17  import "roachpb/api.proto";
    18  import "roachpb/data.proto";
    19  import "util/hlc/timestamp.proto";
    20  
    21  message BatchOperation {
    22    repeated Operation ops = 1 [(gogoproto.nullable) = false];
    23    Result result = 2 [(gogoproto.nullable) = false];
    24  }
    25  
    26  enum ClosureTxnType {
    27    Commit = 0;
    28    Rollback = 1;
    29    // TODO(dan): Ambiguous = 2;
    30  }
    31  
    32  message ClosureTxnOperation {
    33    string txn_id = 1 [(gogoproto.customname) = 'TxnID'];
    34    repeated Operation ops = 2 [(gogoproto.nullable) = false];
    35    BatchOperation commit_in_batch = 3;
    36    ClosureTxnType type = 4;
    37    Result result = 5 [(gogoproto.nullable) = false];
    38    roachpb.Transaction txn = 6;
    39  }
    40  
    41  message GetOperation {
    42    bytes key = 1;
    43    Result result = 2 [(gogoproto.nullable) = false];
    44  }
    45  
    46  message PutOperation {
    47    bytes key = 1;
    48    bytes value = 2;
    49    Result result = 3 [(gogoproto.nullable) = false];
    50  }
    51  
    52  message SplitOperation {
    53    bytes key = 1;
    54    Result result = 2 [(gogoproto.nullable) = false];
    55  }
    56  
    57  message MergeOperation {
    58    bytes key = 1;
    59    Result result = 2 [(gogoproto.nullable) = false];
    60  }
    61  
    62  message ChangeReplicasOperation {
    63    bytes key = 1;
    64    repeated roachpb.ReplicationChange changes = 2 [(gogoproto.nullable) = false];
    65    Result result = 3 [(gogoproto.nullable) = false];
    66  }
    67  
    68  message Operation {
    69    option (gogoproto.goproto_stringer) = false;
    70    option (gogoproto.onlyone) = true;
    71  
    72    BatchOperation batch = 1;
    73  
    74    // TODO(dan): The original prototype of kvnemesis had separate operations for
    75    // {Begin,Use,Commit,Rollback}Txn, which helped generate more interesting
    76    // concurrency traffic. This had some issues with deadlock in the txn wait
    77    // queue, but it seems like it should be possible to bring it back somehow.
    78    ClosureTxnOperation closure_txn = 2;
    79  
    80    GetOperation get = 7;
    81    PutOperation put = 8;
    82    SplitOperation split = 9;
    83    MergeOperation merge = 10;
    84    ChangeReplicasOperation change_replicas = 11;
    85  }
    86  
    87  enum ResultType {
    88    Unknown = 0;
    89    NoError = 1;
    90    Error = 2;
    91    Value = 3;
    92  }
    93  
    94  message Result {
    95    ResultType type = 1;
    96    errorspb.EncodedError err = 2;
    97    // Only set if Type is ResultType_Value. The RawBytes of a roachpb.Value.
    98    bytes value = 3;
    99  }
   100  
   101  message Step {
   102    option (gogoproto.goproto_stringer) = false;
   103    Operation op = 1 [(gogoproto.nullable) = false];
   104    util.hlc.Timestamp before = 2 [(gogoproto.nullable) = false];
   105    util.hlc.Timestamp after = 3 [(gogoproto.nullable) = false];
   106    int32 db_id = 4 [(gogoproto.customname) = 'DBID'];
   107    // Trace will contain the recording of the Step's execution. Used to print it
   108    // out when the test fails.
   109    string trace = 5;
   110  }