type DecoratedAdmin struct {
// Service is the service to decorate.ServiceAdminServer// Prelude is called for each method before forwarding the call to Service.
// If Prelude returns an error, then the call is skipped and the error is
// processed via the Postlude (if one is defined), or it is returned directly.Prelude func(c context.Context, methodName string, req proto.Message) (context.Context, error)
// Postlude is called for each method after Service has processed the call, or
// after the Prelude has returned an error. This takes the the Service's
// response proto (which may be nil) and/or any error. The decorated
// service will return the response (possibly mutated) and error that Postlude
// returns.Postlude func(c context.Context, methodName string, rsp proto.Message, err error) error
}

We can't transactionally enqueue TriageJobStateTask, since its throttling
mechanism uses memcache and named tasks, which are not available inside
transactions. So instead transactions can enqueue KickTriageTask, which in
turn will enqueue TriageJobStateTask (with throttling).

type Timer struct {
// Unique in time identifier of this timer, auto-generated.
//
// It is used to deduplicate and hence provide idempotency for adding
// timers.
//
// Set by the engine, can't be overridden.Idstring `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// Timestamp when the timer was created.
//
// Set by the engine, can't be overridden.Created *timestamp.Timestamp `protobuf:"bytes,2,opt,name=created,proto3" json:"created,omitempty"`
// Target time when this timer activates.
//
// Should be provided by whoever emits the timer.Eta *timestamp.Timestamp `protobuf:"bytes,3,opt,name=eta,proto3" json:"eta,omitempty"`
// User friendly name for this timer that shows up in UI.
//
// Can be provided by whoever emits the timer. Doesn't have to be unique.Titlestring `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"`
// Arbitrary optional payload passed verbatim to the invocation.Payload []byte `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecacheint32 `json:"-"`
}

Timer can be emitted by any invocation if it wants to be poked later.

Timers are scoped to single invocation and owned by it, so we don't include
invocation reference here. It is always available from the context of calls.

TriageJobStateTask looks at the state of the job and decided what to do next.

Enqueued non-transactionally. It is throttled to run approximately once per
second. It looks at pending triggers and recently finished invocations and
launches new invocations (or schedules timers to do it later).

type Trigger struct {
// Unique in time identifier of the trigger.
//
// It is used to deduplicate and hence provide idempotency for adding
// a trigger. Must be provided by whoever emits the trigger.Idstring `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// ID of a job that emitted this trigger or "" if emitted by the engine.
//
// Set by the engine, can't be overridden.JobIdstring `protobuf:"bytes,2,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty"`
// ID of an invocation that emitted this trigger or 0 if emitted by the
// engine.
//
// Set by the engine, can't be overridden.InvocationIdint64 `protobuf:"varint,3,opt,name=invocation_id,json=invocationId,proto3" json:"invocation_id,omitempty"`
// Timestamp when the trigger was created.
//
// Can be set by whoever emits the trigger if the trigger is based on some
// external event. If not provided, the engine will set it to the current
// time.
//
// Together with 'order_in_batch' used for weak ordering of triggers that
// aren't directly comparable (e.g. git commits from different repositories).
// This ordering shouldn't be considered reliable.Created *timestamp.Timestamp `protobuf:"bytes,4,opt,name=created,proto3" json:"created,omitempty"`
// If a bunch of triggers were emitted at the same moment in time (for example
// through a single RPC or by a single invocation in a tight loop), a trigger
// with smaller 'order_in_batch' is considered to be older. Value of
// 'order_in_batch' for triggers with different 'created' timestamps are not
// comparable.
//
// Should be set by whoever emits the trigger if 'created' timestamp was
// supplied explicitly. Otherwise will be set by the engine based on the order
// of EmitTrigger calls done by the invocation.
//
// Together with 'order_in_batch' used for weak ordering of triggers that
// aren't directly comparable (e.g. git commits from different repositories).
// This ordering shouldn't be considered reliable.OrderInBatchint64 `protobuf:"varint,7,opt,name=order_in_batch,json=orderInBatch,proto3" json:"order_in_batch,omitempty"`
// User friendly name for this trigger that shows up in UI.
//
// Can be provided by whoever emits the trigger. Doesn't have to be unique.Titlestring `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"`
// Optional HTTP link to display in UI.
//
// Can be provided by whoever emits the trigger. Doesn't have to be unique.Urlstring `protobuf:"bytes,6,opt,name=url,proto3" json:"url,omitempty"`
// For triggers emitted through public API or "Trigger" button, contains
// identity of a user who submitted this trigger.
//
// Empty for triggers emitted by the service itself.EmittedByUserstring `protobuf:"bytes,8,opt,name=emitted_by_user,json=emittedByUser,proto3" json:"emitted_by_user,omitempty"`
// Actual trigger data that depends on type of the trigger.
//
// Types that are valid to be assigned to Payload:
// *Trigger_Cron
// *Trigger_Webui
// *Trigger_Noop
// *Trigger_Gitiles
// *Trigger_BuildbucketPayload isTrigger_Payload `protobuf_oneof:"payload"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecacheint32 `json:"-"`
}

Trigger can be emitted by the engine itself (e.g. on a schedule) or by
triggering tasks (such as Gitiles tasks).

One or multiple triggers are consumed to initiate a new invocation which has
access to the properties of consumed triggers. For example, Buildbucket task
knows about triggers produced by Gitiles tasks.

This message is an internal representation of the trigger, as stored in
the datastore. See also triggers.Trigger for public representation used in
API calls.