prod

package
v0.0.0-...-6295dec Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2020 License: BSD-3-Clause Imports: 30 Imported by: 0

Documentation

Overview

Package prod provides an implementation of infra/gae/libs/wrapper which backs to appengine.

Index

Constants

This section is empty.

Variables

View Source
var RemoteAPIScopes = []string{
	"https://www.googleapis.com/auth/appengine.apis",
	"https://www.googleapis.com/auth/userinfo.email",
	"https://www.googleapis.com/auth/cloud.platform",
}

RemoteAPIScopes is the set of OAuth2 scopes needed for Remote API access.

Functions

func AEContext

func AEContext(c context.Context) context.Context

AEContext retrieves the raw "google.golang.org/appengine" compatible Context.

It also transfers deadline of `c` to AE context, since deadline is used for RPCs. Doesn't transfer cancelation ability though (since it's ignored by GAE anyway).

func AEContextNoTxn

func AEContextNoTxn(c context.Context) context.Context

AEContextNoTxn retrieves the raw "google.golang.org/appengine" compatible Context that's not part of a transaction.

func Use

Use adds production implementations for all the gae services to the context.

The services added are:

  • github.com/luci-go/common/logging
  • github.com/tetrafolium/gae/service/datastore
  • github.com/tetrafolium/gae/service/info
  • github.com/tetrafolium/gae/service/mail
  • github.com/tetrafolium/gae/service/memcache
  • github.com/tetrafolium/gae/service/module
  • github.com/tetrafolium/gae/service/taskqueue
  • github.com/tetrafolium/gae/service/urlfetch
  • github.com/tetrafolium/gae/service/user

These can be retrieved with the <service>.Get functions.

The implementations are all backed by the real appengine SDK functionality,

func UseBackground

func UseBackground(c context.Context) context.Context

UseBackground is the same as Use except that it activates production implementations which aren't associated with any particular request.

This is only available on Managed VMs.

func UseRemote

func UseRemote(inOutCtx *context.Context, host string, client *http.Client) (err error)

UseRemote is the same as Use, except that it lets you attach a context to a remote host using the Remote API feature. See the docs for the prerequisites.

docs: https://cloud.google.com/appengine/docs/go/tools/remoteapi

inOutCtx will be replaced with the new, derived context, if err is nil, otherwise it's unchanged and continues to be safe-to-use.

If client is nil, this will use create a new client, and will try to be clever about it:

Types

This section is empty.

Notes

Bugs

  • *datastore.Key objects have their AppID dropped when this package

    converts them internally to use with the underlying datastore. In
    practice this shouldn't be much of an issue, since you normally
    have no control over the AppID field of a Key anyway (aside from
    deserializing one directly from a proto).
    

Jump to

Keyboard shortcuts

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