示例#1
0
// useTQ adds a gae.TaskQueue implementation to context, accessible
// by gae.GetTQ(c)
func useTQ(c context.Context) context.Context {
	return tq.SetRawFactory(c, func(ci context.Context, wantTxn bool) tq.RawInterface {
		if wantTxn {
			return tqImpl{AEContext(ci)}
		}
		return tqImpl{AEContextNoTxn(ci)}
	})
}
示例#2
0
func useTQ(c context.Context) context.Context {
	return tq.SetRawFactory(c, func(ic context.Context, wantTxn bool) tq.RawInterface {
		ns := curGID(ic).namespace
		var tqd memContextObj

		if !wantTxn {
			tqd = curNoTxn(ic).Get(memContextTQIdx)
		} else {
			tqd = cur(ic).Get(memContextTQIdx)
		}

		if x, ok := tqd.(*taskQueueData); ok {
			return &taskqueueImpl{x, ic, ns}
		}
		return &taskqueueTxnImpl{tqd.(*txnTaskQueueData), ic, ns}
	})
}
示例#3
0
func useTQ(c context.Context) context.Context {
	return tq.SetRawFactory(c, func(ic context.Context) tq.RawInterface {
		tqd := cur(ic).Get(memContextTQIdx)
		if x, ok := tqd.(*taskQueueData); ok {
			return &taskqueueImpl{
				x,
				ic,
				curGID(ic).namespace,
			}
		}
		return &taskqueueTxnImpl{
			tqd.(*txnTaskQueueData),
			ic,
			curGID(ic).namespace,
		}
	})
}
示例#4
0
// useTQ adds a gae.TaskQueue implementation to context, accessible
// by gae.GetTQ(c)
func useTQ(c context.Context) context.Context {
	return tq.SetRawFactory(c, func(ci context.Context) tq.RawInterface {
		return tqImpl{ci}
	})
}