• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

aetest/H07-Oct-2019-577428

blobstore/H07-Oct-2019-758571

capability/H07-Oct-2019-4822

channel/H07-Oct-2019-11062

cloudsql/H07-Oct-2019-9823

cmd/H07-Oct-2019-2,6592,055

datastore/H07-Oct-2019-7,8086,191

delay/H07-Oct-2019-921672

demos/H07-Oct-2019-195146

file/H07-Oct-2019-2916

image/H07-Oct-2019-6844

internal/H07-Oct-2019-29,17925,342

log/H07-Oct-2019-478328

mail/H07-Oct-2019-190130

memcache/H07-Oct-2019-791553

module/H07-Oct-2019-239187

remote_api/H07-Oct-2019-392298

runtime/H07-Oct-2019-251180

search/H07-Oct-2019-3,2202,479

socket/H07-Oct-2019-367261

taskqueue/H07-Oct-2019-716555

urlfetch/H07-Oct-2019-211147

user/H07-Oct-2019-322221

xmpp/H07-Oct-2019-428317

.travis.ymlH A D07-Oct-2019301 2116

CONTRIBUTING.mdH A D07-Oct-20193.6 KiB9166

LICENSEH A D07-Oct-201911.1 KiB203169

README.mdH A D07-Oct-20194.7 KiB10071

appengine.goH A D07-Oct-20194.2 KiB13645

appengine_test.goH A D07-Oct-2019755 5042

appengine_vm.goH A D07-Oct-2019548 218

errors.goH A D07-Oct-20191.1 KiB4730

go.modH A D07-Oct-2019171 107

go.sumH A D07-Oct-20191,010 1211

identity.goH A D07-Oct-20195.2 KiB14386

namespace.goH A D07-Oct-2019761 2614

namespace_test.goH A D07-Oct-2019888 4030

timeout.goH A D07-Oct-2019465 2113

travis_install.shH A D07-Oct-2019590 1911

travis_test.shH A D07-Oct-2019338 1310

README.md

1# Go App Engine packages
2
3[![Build Status](https://travis-ci.org/golang/appengine.svg)](https://travis-ci.org/golang/appengine)
4
5This repository supports the Go runtime on *App Engine standard*.
6It provides APIs for interacting with App Engine services.
7Its canonical import path is `google.golang.org/appengine`.
8
9See https://cloud.google.com/appengine/docs/go/
10for more information.
11
12File issue reports and feature requests on the [GitHub's issue
13tracker](https://github.com/golang/appengine/issues).
14
15## Upgrading an App Engine app to the flexible environment
16
17This package does not work on *App Engine flexible*.
18
19There are many differences between the App Engine standard environment and
20the flexible environment.
21
22See the [documentation on upgrading to the flexible environment](https://cloud.google.com/appengine/docs/flexible/go/upgrading).
23
24## Directory structure
25
26The top level directory of this repository is the `appengine` package. It
27contains the
28basic APIs (e.g. `appengine.NewContext`) that apply across APIs. Specific API
29packages are in subdirectories (e.g. `datastore`).
30
31There is an `internal` subdirectory that contains service protocol buffers,
32plus packages required for connectivity to make API calls. App Engine apps
33should not directly import any package under `internal`.
34
35## Updating from legacy (`import "appengine"`) packages
36
37If you're currently using the bare `appengine` packages
38(that is, not these ones, imported via `google.golang.org/appengine`),
39then you can use the `aefix` tool to help automate an upgrade to these packages.
40
41Run `go get google.golang.org/appengine/cmd/aefix` to install it.
42
43### 1. Update import paths
44
45The import paths for App Engine packages are now fully qualified, based at `google.golang.org/appengine`.
46You will need to update your code to use import paths starting with that; for instance,
47code importing `appengine/datastore` will now need to import `google.golang.org/appengine/datastore`.
48
49### 2. Update code using deprecated, removed or modified APIs
50
51Most App Engine services are available with exactly the same API.
52A few APIs were cleaned up, and there are some differences:
53
54* `appengine.Context` has been replaced with the `Context` type from `golang.org/x/net/context`.
55* Logging methods that were on `appengine.Context` are now functions in `google.golang.org/appengine/log`.
56* `appengine.Timeout` has been removed. Use `context.WithTimeout` instead.
57* `appengine.Datacenter` now takes a `context.Context` argument.
58* `datastore.PropertyLoadSaver` has been simplified to use slices in place of channels.
59* `delay.Call` now returns an error.
60* `search.FieldLoadSaver` now handles document metadata.
61* `urlfetch.Transport` no longer has a Deadline field; set a deadline on the
62  `context.Context` instead.
63* `aetest` no longer declares its own Context type, and uses the standard one instead.
64* `taskqueue.QueueStats` no longer takes a maxTasks argument. That argument has been
65  deprecated and unused for a long time.
66* `appengine.BackendHostname` and `appengine.BackendInstance` were for the deprecated backends feature.
67  Use `appengine.ModuleHostname`and `appengine.ModuleName` instead.
68* Most of `appengine/file` and parts of `appengine/blobstore` are deprecated.
69  Use [Google Cloud Storage](https://godoc.org/cloud.google.com/go/storage) if the
70  feature you require is not present in the new
71  [blobstore package](https://google.golang.org/appengine/blobstore).
72* `appengine/socket` is not required on App Engine flexible environment / Managed VMs.
73  Use the standard `net` package instead.
74
75## Key Encode/Decode compatibiltiy to help with datastore library migrations
76
77Key compatibility updates have been added to help customers transition from google.golang.org/appengine/datastore to cloud.google.com/go/datastore.
78The `EnableKeyConversion` enables automatic conversion from a key encoded with cloud.google.com/go/datastore to google.golang.org/appengine/datastore key type.
79
80### Enabling key conversion
81
82Enable key conversion by calling `EnableKeyConversion(ctx)` in the `/_ah/start` handler for basic and manual scaling or any handler in automatic scaling.
83
84#### 1. Basic or manual scaling
85
86This start handler will enable key conversion for all handlers in the service.
87
88```
89http.HandleFunc("/_ah/start", func(w http.ResponseWriter, r *http.Request) {
90    datastore.EnableKeyConversion(appengine.NewContext(r))
91})
92```
93
94#### 2. Automatic scaling
95
96`/_ah/start` is not supported for automatic scaling and `/_ah/warmup` is not guaranteed to run, so you must call `datastore.EnableKeyConversion(appengine.NewContext(r))`
97before you use code that needs key conversion.
98
99You may want to add this to each of your handlers, or introduce middleware where it's called.
100`EnableKeyConversion` is safe for concurrent use. Any call to it after the first is ignored.