• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

luci / gae / 176
82%

Build:
DEFAULT BRANCH: master
Ran 19 Sep 2016 02:23AM UTC
Jobs 1
Files 0
Run time –
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
176

push

travis-ci

Commit bot
Interface update, per-method Contexts.

This is a very large patch that fixes #53. It carries some additional
changes. This is an API change, and will break virtually all users of
any "luci/gae" packages. The API update is trivial, though.

This patch:
- Remove user-facing "Interface" interfaces, when present, in favor of
  package-level methods that each individually accept a Context parameter.
- Remove package-level "Get" methods for services in favor of directly
  using package-level methods.
- Standardize all service/... packages' primary interfaces as
  "RawInterface" instead of "Interface".
- Add a datastore Transaction tracking interface, allowing a user to get
  or set the current datastore transaction in the Context. This replaces
  GetNoTxn-style methods in favor of setting a "nil" transaction which,
  as it happens, is the only implemented part of the interface.
- Introduce "KeyContext" to "services/datastore", which retains an AppID
  and Namespace tuple and uses them as a base to generate GAE keys.
  Rewrite several internal methods to use KeyContext.
- Rename "Testable" interface method to "GetTestable" since it's
  top-level now and it would conflict with the actual interface
  definition.
- Remove the boolean return value from the info service's "GetNamespace"
  now that the empty string equals the default namespace.
- Change *Multi "service/taskqueue" and "service/memcache" APIs to use
  singular vararg versions.

The transaction interface was added here (as opposed to another patch
set) because it is complementary to the API changes required in
datastore and taskqueue services to use Contexts directly. This is somewhat
at odds with the *NoTxn-style function calls, which have consequently been
removed in favor of setting a "nil" Transaction. The datastore Transaction
interface is something that has been desired for a while, so supporting nil
Transactions should be a good starting point without over-committing (e.g.,
actually hacking transaction manipulation into "impl/prod").

Migrating code to the new-style API should be fairly straightforward:
- Calls to "service/*" methods will no longer call "Get" to get an
  Interface instance; instead, use package-level calls and pass the
  Context as an extra parameter.

  BEFORE:
  ds := datastore.Get(c)
  if err := ds.Get(obj0, obj1, ...); err != nil { ... }

  NOW:
  if err := datastore.Get(c, obj0, obj1, ...); err != nil { ... }

- The "*NoTxn"-style calls are gone, replaced by installing a nil
  datastore Transaction.

  BEFORE:
  datastore.GetNoTxn(c).Put(obj0)
  taskqueue.GetNoTxn(c).Add(task)
  prod.AEContextNoTxn(c)

  NOW:
  datastore.Put(datastore.WithoutTransaction(c), obj0)
  taskqueue.Add(datastore.WithoutTransaction(c), task)
  prod.AEContext(datastore.WithoutTransaction(c))

- Methods generating full datastore keys (manually specifying app ID and
  namespace) now must use a KeyContext instance. This isn't expected to be
  a problem, since most external packages should not be using direct key
  generation, but should, instead, be using the datastore-bound versions of
  those methods.

  BEFORE:
  key := datastore.MakeKey("aid", "ns", "kind", "stringID")

  NOW:
  key := datastore.KeyContext{"aid", "ns"}.MakeKey("kind", "stringID")

- Methods using *Multi versions of public interfaces should use singular
  versions. Additonally, to support this, the queue name and task list
  parameter positions have been swapped.

  If the error return value is being examined for anything
  more than non-nil-ness, keep an eye out for the single-argument case, which
  returns the error directly instead of wrapping it in a MultiError.

  BEFORE:
  taskqueue.Get(c).AddMulti([]*taskqueue.Task{t0, t1, t2}, "queueName")

  NOW:
  taskqueue.Add(c, "queueName", t0, t1, t2)

BUG=None
TEST=local
  - All unit tests pass locally.
  - Ran "impl/cloud" tests successfully against emulator.
  - Ran `goapp test` on "impl/prod" successfully.

patch from issue 2302743002 at patchset 1 (http://crrev.com/2302743002#ps1)

Review-Url: https://codereview.chromium.org/2302743002
Jobs
ID Job ID Ran Files Coverage
1 176.1 19 Sep 2016 02:23AM UTC 0
Travis Job 176.1
Source Files on build 176
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #176
  • 3715a27a on github
  • Prev Build on master (#175)
  • Next Build on master (#177)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc