OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package distributor |
| 6 |
| 7 import ( |
| 8 "golang.org/x/net/context" |
| 9 |
| 10 "github.com/golang/protobuf/proto" |
| 11 "github.com/luci/gae/service/taskqueue" |
| 12 ) |
| 13 |
| 14 // Config represents the configuration for a single instance of a given |
| 15 // distributor implementation at a given point in time (e.g. version). |
| 16 type Config struct { |
| 17 // DMBaseURL is the base url for the DM API. This may be used by the |
| 18 // distributor implementation to pass to jobs so that they can call back
into |
| 19 // DM's api. |
| 20 DMBaseURL string |
| 21 |
| 22 // Name is the name of this distributor configuration. This is always th
e |
| 23 // fully-resolved name of the configuration (i.e. aliases are dereferenc
ed). |
| 24 Name string |
| 25 |
| 26 // Version is the version of the distributor configuration retrieved fro
m |
| 27 // luci-config. |
| 28 Version string |
| 29 |
| 30 // Content is the actual parsed implementation-specific configuration. |
| 31 Content proto.Message |
| 32 } |
| 33 |
| 34 // EnqueueTask allows a Distributor to enqueue a TaskQueue task that will be |
| 35 // handled by the Distributor's HandleTaskQueueTask method. |
| 36 func (cfg *Config) EnqueueTask(c context.Context, tsk *taskqueue.Task) error { |
| 37 tsk.Path = handlerPath(cfg.Name) |
| 38 return taskqueue.Get(c).Add(tsk, "") |
| 39 } |
OLD | NEW |