gae

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package gae implements minimal support for using some bundled GAE APIs.

It is essentially a reimplementation of a small subset of Golang GAE SDK v2, since the SDK is not very interoperable with non-GAE code, see e.g. https://github.com/golang/appengine/issues/265.

Following sources were used as a base:

Some proto files were copied, and their proto package and `go_package` updated to reflect their new location to avoid clashing with real GAE SDK protos in the registry and to conform to modern protoc-gen-go requirement of using full Go package paths:

  • v2/internal/base/api_base.proto => base/
  • v2/internal/mail/mail_service.proto => mail/
  • v2/internal/remote_api/remote_api.proto => remote_api/

The rest is written from scratch based on what the SDK is doing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(ctx context.Context, service, method string, in, out proto.Message) (err error)

Call makes an RPC to the GAE service bridge.

Uses tickets in the context (see WithTickets). Returns an error if they are not there.

Note: currently returns opaque stringy errors. Refactor if you need to distinguish API errors from transport errors or need error codes, etc.

func WithTickets

func WithTickets(ctx context.Context, tickets *Tickets) context.Context

WithTickets puts the tickets into the context.Context.

Types

type Headers

type Headers interface {
	Header(string) string
}

Headers knows how to return request headers.

type Tickets

type Tickets struct {
	// contains filtered or unexported fields
}

Tickets lives in context.Context and carries per-request information.

func DefaultTickets

func DefaultTickets() *Tickets

DefaultTickets generates default background tickets.

They are used for calls outside of request handlers. Uses GAE environment variables.

func RequestTickets

func RequestTickets(headers Headers) *Tickets

RequestTickets extracts tickets from incoming request headers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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