Documentation ¶
Overview ¶
Package internal provides support for package appengine.
Programs should not use this package directly. Its API is not stable. Use packages appengine and appengine/* instead.
Index ¶
- Variables
- func AppID(c netcontext.Context) string
- func BackgroundContext() netcontext.Context
- func Call(ctx netcontext.Context, service, method string, in, out proto.Message) error
- func ContextForTesting(req *http.Request) netcontext.Context
- func Datacenter(ctx netcontext.Context) string
- func DefaultTicket() string
- func DefaultVersionHostname(ctx netcontext.Context) string
- func FullyQualifiedAppID(ctx netcontext.Context) string
- func IncomingHeaders(ctx netcontext.Context) http.Header
- func InstanceID() string
- func IsAppEngine() bool
- func IsDevAppServer() bool
- func IsFlex() bool
- func IsSecondGen() bool
- func IsStandard() bool
- func Logf(ctx netcontext.Context, level int64, format string, args ...interface{})
- func Main()
- func ModuleName(_ netcontext.Context) string
- func NamespaceFromContext(ctx netcontext.Context) string
- func NamespacedContext(ctx netcontext.Context, namespace string) netcontext.Context
- func RegisterErrorCodeMap(service string, m map[int32]string)
- func RegisterTestRequest(req *http.Request, apiURL *url.URL, ...) (*http.Request, func())
- func RegisterTimeoutErrorCode(service string, code int32)
- func RegisterTransactionSetter(f interface{})
- func ReqContext(req *http.Request) netcontext.Context
- func RequestID(ctx netcontext.Context) string
- func RunTransactionOnce(c netcontext.Context, f func(netcontext.Context) error, xg bool, readOnly bool, ...) (*pb.Transaction, error)
- func ServerSoftware() string
- func SetTestEnv() func()
- func VersionID(_ netcontext.Context) string
- func WithAppIDOverride(ctx netcontext.Context, appID string) netcontext.Context
- func WithCallOverride(ctx netcontext.Context, f CallOverrideFunc) netcontext.Context
- func WithContext(parent netcontext.Context, req *http.Request) netcontext.Context
- func WithLogOverride(ctx netcontext.Context, f logOverrideFunc) netcontext.Context
- type APIError
- type CallError
- type CallOverrideFunc
Constants ¶
This section is empty.
Variables ¶
var MainPath string
MainPath stores the file path of the main package. On App Engine Standard using Go version 1.9 and below, this will be unset. On App Engine Flex and App Engine Standard second-gen (Go 1.11 and above), this will be the filepath to package main.
NamespaceMods is a map from API service to a function that will mutate an RPC request to attach a namespace. The function should be prepared to be called on the same message more than once; it should only modify the RPC request the first time.
Functions ¶
func AppID ¶
func AppID(c netcontext.Context) string
AppID is the implementation of the wrapper function of the same name in ../identity.go. See that file for commentary.
func BackgroundContext ¶
func BackgroundContext() netcontext.Context
func ContextForTesting ¶
func ContextForTesting(req *http.Request) netcontext.Context
func Datacenter ¶
func Datacenter(ctx netcontext.Context) string
func DefaultTicket ¶
func DefaultTicket() string
DefaultTicket returns a ticket used for background context or dev_appserver.
func DefaultVersionHostname ¶
func DefaultVersionHostname(ctx netcontext.Context) string
func FullyQualifiedAppID ¶
func FullyQualifiedAppID(ctx netcontext.Context) string
FullyQualifiedAppID returns the fully-qualified application ID. This may contain a partition prefix (e.g. "s~" for High Replication apps), or a domain prefix (e.g. "example.com:").
func IncomingHeaders ¶
func IncomingHeaders(ctx netcontext.Context) http.Header
func IsAppEngine ¶
func IsAppEngine() bool
IsAppEngine is the implementation of the wrapper function of the same name in ../appengine.go. See that file for commentary.
func IsFlex ¶
func IsFlex() bool
IsFlex is the implementation of the wrapper function of the same name in ../appengine.go. See that file for commentary.
func IsSecondGen ¶
func IsSecondGen() bool
IsStandard is the implementation of the wrapper function of the same name in ../appengine.go. See that file for commentary.
func IsStandard ¶
func IsStandard() bool
IsStandard is the implementation of the wrapper function of the same name in ../appengine.go. See that file for commentary.
func Logf ¶
func Logf(ctx netcontext.Context, level int64, format string, args ...interface{})
func Main ¶
func Main()
func ModuleName ¶
func ModuleName(_ netcontext.Context) string
func NamespaceFromContext ¶
func NamespaceFromContext(ctx netcontext.Context) string
func NamespacedContext ¶
func NamespacedContext(ctx netcontext.Context, namespace string) netcontext.Context
NamespacedContext wraps a Context to support namespaces.
func RegisterErrorCodeMap ¶
RegisterErrorCodeMap is called from API implementations to register their error code map. This should only be called from init functions.
func RegisterTestRequest ¶
func RegisterTestRequest(req *http.Request, apiURL *url.URL, decorate func(netcontext.Context) netcontext.Context) (*http.Request, func())
RegisterTestRequest registers the HTTP request req for testing, such that any API calls are sent to the provided URL. It returns a closure to delete the registration. It should only be used by aetest package.
func RegisterTransactionSetter ¶
func RegisterTransactionSetter(f interface{})
RegisterTransactionSetter registers a function that sets transaction information in a protocol buffer message. f should be a function with two arguments, the first being a protocol buffer type, and the second being *datastore.Transaction.
func ReqContext ¶
func ReqContext(req *http.Request) netcontext.Context
func RequestID ¶
func RequestID(ctx netcontext.Context) string
func RunTransactionOnce ¶
func RunTransactionOnce(c netcontext.Context, f func(netcontext.Context) error, xg bool, readOnly bool, previousTransaction *pb.Transaction) (*pb.Transaction, error)
func SetTestEnv ¶
func SetTestEnv() func()
SetTestEnv sets the env variables for testing background ticket in Flex.
func VersionID ¶
func VersionID(_ netcontext.Context) string
func WithAppIDOverride ¶
func WithAppIDOverride(ctx netcontext.Context, appID string) netcontext.Context
func WithCallOverride ¶
func WithCallOverride(ctx netcontext.Context, f CallOverrideFunc) netcontext.Context
func WithContext ¶
func WithContext(parent netcontext.Context, req *http.Request) netcontext.Context
func WithLogOverride ¶
func WithLogOverride(ctx netcontext.Context, f logOverrideFunc) netcontext.Context
Types ¶
type APIError ¶
APIError is the type returned by appengine.Context's Call method when an API call fails in an API-specific way. This may be, for instance, a taskqueue API call failing with TaskQueueServiceError::UNKNOWN_QUEUE.