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