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

Unified Diff: service/taskqueue/types.go

Issue 1243323002: Refactor a bit. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix golint Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « service/taskqueue/testable.go ('k') | service_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/taskqueue/types.go
diff --git a/upstream_types.go b/service/taskqueue/types.go
similarity index 52%
rename from upstream_types.go
rename to service/taskqueue/types.go
index e6b41bcb3ed49cb8fd11f0addce5a0b768598534..c8cde3996c2f3e96d8568ec529a2cc7b15b21f97 100644
--- a/upstream_types.go
+++ b/service/taskqueue/types.go
@@ -7,78 +7,19 @@
// without necessarially needing an SDK implementation present.
//
// This was done (instead of type-aliasing from the github version of the SDK)
-// because some of the types need to be tweaked (like TQTask.RetryOptions) to
+// because some of the types need to be tweaked (like Task.RetryOptions) to
// interact well with the wrapper, and the inconsistency of having some types
// defined by the gae package and others defined by the SDK was pretty awkward.
-package gae
+package taskqueue
import (
"net/http"
"time"
)
-// DSByteString is a short byte slice (up to 1500 bytes) that can be indexed.
-type DSByteString []byte
-
-// BSKey is a key for a blobstore blob.
-//
-// Conceptually, this type belongs in the blobstore package, but it lives in the
-// appengine package to avoid a circular dependency: blobstore depends on
-// datastore, and datastore needs to refer to the BSKey type.
-//
-// Blobstore is NOT YET supported by gae, but may be supported later. Its
-// inclusion here is so that the RawDatastore can interact (and round-trip)
-// correctly with other datastore API implementations.
-type BSKey string
-
-// DSGeoPoint represents a location as latitude/longitude in degrees.
-//
-// You probably shouldn't use these, but their inclusion here is so that the
-// RawDatastore can interact (and round-trip) correctly with other datastore API
-// implementations.
-type DSGeoPoint struct {
- Lat, Lng float64
-}
-
-// Valid returns whether a DSGeoPoint is within [-90, 90] latitude and [-180,
-// 180] longitude.
-func (g DSGeoPoint) Valid() bool {
- return -90 <= g.Lat && g.Lat <= 90 && -180 <= g.Lng && g.Lng <= 180
-}
-
-// DSTransactionOptions are the options for running a transaction.
-type DSTransactionOptions struct {
- // XG is whether the transaction can cross multiple entity groups. In
- // comparison, a single group transaction is one where all datastore keys
- // used have the same root key. Note that cross group transactions do not
- // have the same behavior as single group transactions. In particular, it
- // is much more likely to see partially applied transactions in different
- // entity groups, in global queries.
- // It is valid to set XG to true even if the transaction is within a
- // single entity group.
- XG bool
- // Attempts controls the number of retries to perform when commits fail
- // due to a conflicting transaction. If omitted, it defaults to 3.
- Attempts int
-}
-
-// MCStatistics represents a set of statistics about the memcache cache. This
-// may include items that have expired but have not yet been removed from the
-// cache.
-type MCStatistics struct {
- Hits uint64 // Counter of cache hits
- Misses uint64 // Counter of cache misses
- ByteHits uint64 // Counter of bytes transferred for gets
-
- Items uint64 // Items currently in the cache
- Bytes uint64 // Size of all items currently in the cache
-
- Oldest int64 // Age of access of the oldest item, in seconds
-}
-
-// TQStatistics represents statistics about a single task queue.
-type TQStatistics struct {
+// Statistics represents statistics about a single task queue.
+type Statistics struct {
Tasks int // may be an approximation
OldestETA time.Time // zero if there are no pending tasks
@@ -87,8 +28,8 @@ type TQStatistics struct {
EnforcedRate float64 // requests per second
}
-// TQRetryOptions let you control whether to retry a task and the backoff intervals between tries.
-type TQRetryOptions struct {
+// RetryOptions let you control whether to retry a task and the backoff intervals between tries.
+type RetryOptions struct {
// Number of tries/leases after which the task fails permanently and is deleted.
// If AgeLimit is also set, both limits must be exceeded for the task to fail permanently.
RetryLimit int32
@@ -111,8 +52,8 @@ type TQRetryOptions struct {
ApplyZeroMaxDoublings bool
}
-// TQTask represents a taskqueue task to be executed.
-type TQTask struct {
+// Task represents a taskqueue task to be executed.
+type Task struct {
// Path is the worker URL for the task.
// If unset, it will default to /_ah/queue/<queue_name>.
Path string
@@ -154,11 +95,5 @@ type TQTask struct {
Tag string
// Retry options for this task. May be nil.
- RetryOptions *TQRetryOptions
-}
-
-// GICertificate represents a public certificate for the app.
-type GICertificate struct {
- KeyName string
- Data []byte // PEM-encoded X.509 certificate
+ RetryOptions *RetryOptions
}
« no previous file with comments | « service/taskqueue/testable.go ('k') | service_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698