Documentation ¶
Overview ¶
Package vtrpc is a generated protocol buffer package.
It is generated from these files:
vtrpc.proto
It has these top-level messages:
CallerID RPCError
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrorCodeDeprecated_name = map[int32]string{
0: "NoError",
1000: "TabletError",
1999: "UnknownTabletError",
2000: "VtgateError",
2999: "UnknownVtgateError",
}
var ErrorCodeDeprecated_value = map[string]int32{
"NoError": 0,
"TabletError": 1000,
"UnknownTabletError": 1999,
"VtgateError": 2000,
"UnknownVtgateError": 2999,
}
var ErrorCode_name = map[int32]string{
0: "SUCCESS",
1: "CANCELLED",
2: "UNKNOWN_ERROR",
3: "BAD_INPUT",
4: "DEADLINE_EXCEEDED",
5: "INTEGRITY_ERROR",
6: "PERMISSION_DENIED",
7: "THROTTLED_ERROR",
8: "QUERY_NOT_SERVED",
9: "NOT_IN_TX",
10: "INTERNAL_ERROR",
11: "RESOURCE_TEMPORARILY_UNAVAILABLE",
}
var ErrorCode_value = map[string]int32{
"SUCCESS": 0,
"CANCELLED": 1,
"UNKNOWN_ERROR": 2,
"BAD_INPUT": 3,
"DEADLINE_EXCEEDED": 4,
"INTEGRITY_ERROR": 5,
"PERMISSION_DENIED": 6,
"THROTTLED_ERROR": 7,
"QUERY_NOT_SERVED": 8,
"NOT_IN_TX": 9,
"INTERNAL_ERROR": 10,
"RESOURCE_TEMPORARILY_UNAVAILABLE": 11,
}
Functions ¶
This section is empty.
Types ¶
type CallerID ¶
type CallerID struct { // principal is the effective user identifier. It is usually filled in // with whoever made the request to the appserver, if the request // came from an automated job or another system component. // If the request comes directly from the Internet, or if the Vitess client // takes action on its own accord, it is okay for this field to be absent. Principal string `protobuf:"bytes,1,opt,name=principal" json:"principal,omitempty"` // component describes the running process of the effective caller. // It can for instance be the hostname:port of the servlet initiating the // database call, or the container engine ID used by the servlet. Component string `protobuf:"bytes,2,opt,name=component" json:"component,omitempty"` // subcomponent describes a component inisde the immediate caller which // is responsible for generating is request. Suggested values are a // servlet name or an API endpoint name. Subcomponent string `protobuf:"bytes,3,opt,name=subcomponent" json:"subcomponent,omitempty"` }
CallerID is passed along RPCs to identify the originating client for a request. It is not meant to be secure, but only informational. The client can put whatever info they want in these fields, and they will be trusted by the servers. The fields will just be used for logging purposes, and to easily find a client. VtGate propagates it to VtTablet, and VtTablet may use this information for monitoring purposes, to display on dashboards, or for blacklisting purposes.
func (*CallerID) ProtoMessage ¶
func (*CallerID) ProtoMessage()
type ErrorCode ¶
type ErrorCode int32
ErrorCode is the enum values for Errors. Internally, errors should be created with one of these codes. These will then be translated over the wire by various RPC frameworks.
const ( // SUCCESS is returned from a successful call ErrorCode_SUCCESS ErrorCode = 0 // CANCELLED means that the context was cancelled (and noticed in the app layer, // as opposed to the RPC layer) ErrorCode_CANCELLED ErrorCode = 1 // UNKNOWN_ERROR includes: // 1. MySQL error codes that we don't explicitly handle // 2. MySQL response that wasn't as expected. For example, we might expect a MySQL // timestamp to be returned in a particular way, but it wasn't. // 3. Anything else that doesn't fall into a different bucket. ErrorCode_UNKNOWN_ERROR ErrorCode = 2 // BAD_INPUT is returned when an end-user either sends SQL that couldn't be parsed correctly, // or tries a query that isn't supported by Vitess. ErrorCode_BAD_INPUT ErrorCode = 3 // DEADLINE_EXCEEDED is returned when an action is taking longer than a given timeout. ErrorCode_DEADLINE_EXCEEDED ErrorCode = 4 // INTEGRITY_ERROR is returned on integrity error from MySQL, usually due to // duplicate primary keys ErrorCode_INTEGRITY_ERROR ErrorCode = 5 // PERMISSION_DENIED errors are returned when a user requests access to something // that they don't have permissions for. ErrorCode_PERMISSION_DENIED ErrorCode = 6 // THROTTLED_ERROR is returned when a user exceeds their quota in some dimension and // get throttled due to that. ErrorCode_THROTTLED_ERROR ErrorCode = 7 // QUERY_NOT_SERVED means that a query could not be served right now. // This could be due to various reasons: QueryService is not running, // should not be running, wrong shard, wrong tablet type, etc. Clients that // receive this error should usually re-resolve the topology, and then retry the query. ErrorCode_QUERY_NOT_SERVED ErrorCode = 8 // NOT_IN_TX means that we're not currently in a transaction, but we should be. ErrorCode_NOT_IN_TX ErrorCode = 9 // INTERNAL_ERROR is returned when: // 1. Something is not configured correctly internally. // 2. A necessary resource is not available // 3. Some other internal error occures // INTERNAL_ERRORs are not problems that are expected to fix themselves, and retrying // the query will not help. ErrorCode_INTERNAL_ERROR ErrorCode = 10 // RESOURCE_TEMPORARILY_UNAVAILABLE is used for when a resource limit has temporarily // been reached. Trying this error, with an exponential backoff, should succeed. // Various types of resources can be exhausted, including: // 1. TxPool can be full // 2. VtGate could have request backlog // 3. MySQL could have a deadlock ErrorCode_RESOURCE_TEMPORARILY_UNAVAILABLE ErrorCode = 11 )
type ErrorCodeDeprecated ¶
type ErrorCodeDeprecated int32
ErrorCodeDeprecated is the enum values for Errors. These are deprecated errors, we should instead be using ErrorCode.
const ( // NoError means there was no error, and the message should be ignored. ErrorCodeDeprecated_NoError ErrorCodeDeprecated = 0 // TabletError is the base VtTablet error. All VtTablet errors // should be 4 digits, starting with 1. ErrorCodeDeprecated_TabletError ErrorCodeDeprecated = 1000 // UnknownTabletError is the code for an unknown error that came // from VtTablet. ErrorCodeDeprecated_UnknownTabletError ErrorCodeDeprecated = 1999 // VtgateError is the base VTGate error code. All VTGate errors // should be 4 digits, starting with 2. ErrorCodeDeprecated_VtgateError ErrorCodeDeprecated = 2000 // UnknownVtgateError is the code for an unknown error that came from VTGate. ErrorCodeDeprecated_UnknownVtgateError ErrorCodeDeprecated = 2999 )
func (ErrorCodeDeprecated) String ¶
func (x ErrorCodeDeprecated) String() string
type RPCError ¶
type RPCError struct { Code ErrorCodeDeprecated `protobuf:"varint,1,opt,name=code,enum=vtrpc.ErrorCodeDeprecated" json:"code,omitempty"` Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` }
RPCError is an application-level error structure returned by VtTablet (and passed along by VtGate if appropriate). We use this so the clients don't have to parse the error messages, but instead can depend on the value of the code.
func (*RPCError) ProtoMessage ¶
func (*RPCError) ProtoMessage()