vtrpc

package
v2.0.0-rc.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2016 License: BSD-3-Clause Imports: 3 Imported by: 0

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

View Source
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:  "RESOURCE_EXHAUSTED",
	8:  "QUERY_NOT_SERVED",
	9:  "NOT_IN_TX",
	10: "INTERNAL_ERROR",
	11: "TRANSIENT_ERROR",
	12: "UNAUTHENTICATED",
}
View Source
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,
	"RESOURCE_EXHAUSTED": 7,
	"QUERY_NOT_SERVED":   8,
	"NOT_IN_TX":          9,
	"INTERNAL_ERROR":     10,
	"TRANSIENT_ERROR":    11,
	"UNAUTHENTICATED":    12,
}

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) Descriptor

func (*CallerID) Descriptor() ([]byte, []int)

func (*CallerID) ProtoMessage

func (*CallerID) ProtoMessage()

func (*CallerID) Reset

func (m *CallerID) Reset()

func (*CallerID) String

func (m *CallerID) String() string

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
	// RESOURCE_EXHAUSTED is returned when a query exceeds its quota in some dimension
	// and can't be completed due to that. Queries that return RESOURCE_EXHAUSTED
	// should not be retried, as it could be detrimental to the server's health.
	// Examples of errors that will cause the RESOURCE_EXHAUSTED code:
	// 1. TxPoolFull: this is retried server-side, and is only returned as an error
	//  if the server-side retries failed.
	// 2. Query is killed due to it taking too long.
	ErrorCode_RESOURCE_EXHAUSTED ErrorCode = 7
	// QUERY_NOT_SERVED means that a query could not be served right now.
	// Client can interpret it as: "the tablet that you sent this query to cannot
	// serve the query right now, try a different tablet or try again later."
	// This could be due to various reasons: QueryService is not serving, should
	// not be serving, wrong shard, wrong tablet type, blacklisted table, etc.
	// Clients that receive this error should usually retry the query, but after taking
	// the appropriate steps to make sure that the query will get sent to the correct
	// tablet.
	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_ERRORs are problems that only the server can fix, not the client.
	// These errors are not due to a query itself, but rather due to the state of
	// the system.
	// Generally, we don't expect the errors to go away by themselves, but they
	// may go away after human intervention.
	// Examples of scenarios where INTERNAL_ERROR is returned:
	//  1. Something is not configured correctly internally.
	//  2. A necessary resource is not available, and we don't expect it to become available by itself.
	//  3. A sanity check fails.
	//  4. Some other internal error occurs.
	// Clients should not retry immediately, as there is little chance of success.
	// However, it's acceptable for retries to happen internally, for example to
	// multiple backends, in case only a subset of backend are not functional.
	ErrorCode_INTERNAL_ERROR ErrorCode = 10
	// TRANSIENT_ERROR is used for when there is some error that we expect we can
	// recover from automatically - often due to a resource limit temporarily being
	// reached. Retrying this error, with an exponential backoff, should succeed.
	// Clients should be able to successfully retry the query on the same backends.
	// Examples of things that can trigger this error:
	// 1. Query has been throttled
	// 2. VtGate could have request backlog
	ErrorCode_TRANSIENT_ERROR ErrorCode = 11
	// UNAUTHENTICATED errors are returned when a user requests access to something,
	// and we're unable to verify the user's authentication.
	ErrorCode_UNAUTHENTICATED ErrorCode = 12
)

func (ErrorCode) EnumDescriptor

func (ErrorCode) EnumDescriptor() ([]byte, []int)

func (ErrorCode) String

func (x ErrorCode) String() string

type RPCError

type RPCError struct {
	Code    ErrorCode `protobuf:"varint,1,opt,name=code,enum=vtrpc.ErrorCode" 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) Descriptor

func (*RPCError) Descriptor() ([]byte, []int)

func (*RPCError) ProtoMessage

func (*RPCError) ProtoMessage()

func (*RPCError) Reset

func (m *RPCError) Reset()

func (*RPCError) String

func (m *RPCError) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL