go.uber.org/yarpc@v1.72.1/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/atomic.thrift (about) 1 include "./common.thrift" 2 3 exception KeyDoesNotExist { 4 1: optional string key 5 } ( 6 rpc.code = "INVALID_ARGUMENT" 7 ) 8 9 exception IntegerMismatchError { 10 1: required i64 expectedValue 11 2: required i64 gotValue 12 } ( 13 rpc.code = "INVALID_ARGUMENT" 14 ) 15 16 struct CompareAndSwap { 17 1: required string key 18 2: required i64 currentValue 19 3: required i64 newValue 20 } 21 22 service ReadOnlyStore extends common.BaseService { 23 i64 integer(1: string key) throws (1: KeyDoesNotExist doesNotExist) 24 } 25 26 service Store extends ReadOnlyStore { 27 void increment(1: string key, 2: i64 value) 28 29 void compareAndSwap(1: CompareAndSwap request) 30 throws (1: IntegerMismatchError mismatch) 31 32 oneway void forget(1: string key) 33 } 34 35 36 // This struct intentionally has the same shape as the `CompareAndSwap` wrapper 37 // `Store_CompareAndSwap_Args`, except all fields are optional. 38 39 // We use this to generate an invalid payload for testing. 40 struct OptionalCompareAndSwapWrapper { 41 1: optional OptionalCompareAndSwap cas 42 } 43 44 struct OptionalCompareAndSwap { 45 1: optional string key 46 2: optional i64 currentValue 47 3: optional i64 newValue 48 }