github.com/s7techlab/cckit@v0.10.5/extensions/debug/debug_state.proto (about) 1 syntax = "proto3"; 2 3 option go_package = "github.com/s7techlab/cckit/extensions/debug"; 4 package extensions.debug; 5 6 import "google/api/annotations.proto"; 7 8 // State key prefix 9 message Prefix { 10 // parts of key 11 repeated string key = 1; 12 } 13 14 message Prefixes { 15 repeated Prefix prefixes = 1; 16 } 17 18 // State key prefix match count 19 message PrefixesMatchCount { 20 map<string, uint32> matches = 1; 21 } 22 23 // State keys 24 message CompositeKeys { 25 repeated CompositeKey keys = 1; 26 } 27 28 // State key 29 message CompositeKey { 30 repeated string key = 1; 31 } 32 33 // State value 34 message Value { 35 repeated string key = 1; 36 bytes value = 2; 37 string json = 3; 38 } 39 40 // Debug state service 41 // allows to directly manage chaincode state 42 service DebugStateService { 43 // Get keys list, returns all keys or, if prefixes are defined, only prefix matched 44 rpc ListKeys (Prefix) returns (CompositeKeys) { 45 option (google.api.http) = { 46 get: "/debug/state/keys/{key}" 47 }; 48 } 49 50 // Get state value by key 51 rpc GetState (CompositeKey) returns (Value) { 52 option (google.api.http) = { 53 get: "/debug/state/{key}" 54 }; 55 } 56 57 // Put state value 58 rpc PutState (Value) returns (Value) { 59 option (google.api.http) = { 60 put : "/debug/state" 61 body: "*" 62 }; 63 } 64 65 // Delete state value 66 rpc DeleteState (CompositeKey) returns (Value) { 67 option (google.api.http) = { 68 delete: "/debug/state/{key}" 69 }; 70 } 71 72 // Delete all states or, if prefixes are defined, only prefix matched 73 rpc DeleteStates (Prefixes) returns (PrefixesMatchCount) { 74 option (google.api.http) = { 75 post: "/debug/state/clean" 76 body: "*" 77 }; 78 } 79 80 }