Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: appengine/cmd/dm/distributor/config.go

Issue 1537883002: Initial distributor implementation (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Fix comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698