| Index: service/datastore/context.go
|
| diff --git a/service/rawdatastore/context.go b/service/datastore/context.go
|
| similarity index 75%
|
| rename from service/rawdatastore/context.go
|
| rename to service/datastore/context.go
|
| index f1603b5af8a983ffa67400114b9a09157c3d62c8..03e2e931e88345204e77811c3f9323fe6150e9c2 100644
|
| --- a/service/rawdatastore/context.go
|
| +++ b/service/datastore/context.go
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -package rawdatastore
|
| +package datastore
|
|
|
| import (
|
| "golang.org/x/net/context"
|
| @@ -17,24 +17,24 @@ var (
|
|
|
| // Factory is the function signature for factory methods compatible with
|
| // SetFactory.
|
| -type Factory func(context.Context) Interface
|
| +type Factory func(context.Context) RawInterface
|
|
|
| // Filter is the function signature for a filter RDS implementation. It
|
| // gets the current RDS implementation, and returns a new RDS implementation
|
| // backed by the one passed in.
|
| -type Filter func(context.Context, Interface) Interface
|
| +type Filter func(context.Context, RawInterface) RawInterface
|
|
|
| -// getUnfiltered gets gets the Interface implementation from context without
|
| +// getUnfiltered gets gets the RawInterface implementation from context without
|
| // any of the filters applied.
|
| -func getUnfiltered(c context.Context) Interface {
|
| +func getUnfiltered(c context.Context) RawInterface {
|
| if f, ok := c.Value(rawDatastoreKey).(Factory); ok && f != nil {
|
| return f(c)
|
| }
|
| return nil
|
| }
|
|
|
| -// Get gets the Interface implementation from context.
|
| -func Get(c context.Context) Interface {
|
| +// GetRaw gets the RawInterface implementation from context.
|
| +func GetRaw(c context.Context) RawInterface {
|
| ret := getUnfiltered(c)
|
| if ret == nil {
|
| return nil
|
| @@ -54,8 +54,8 @@ func SetFactory(c context.Context, rdsf Factory) context.Context {
|
| // Set sets the current Datastore object in the context. Useful for testing with
|
| // a quick mock. This is just a shorthand SetFactory invocation to set a factory
|
| // which always returns the same object.
|
| -func Set(c context.Context, rds Interface) context.Context {
|
| - return SetFactory(c, func(context.Context) Interface { return rds })
|
| +func Set(c context.Context, rds RawInterface) context.Context {
|
| + return SetFactory(c, func(context.Context) RawInterface { return rds })
|
| }
|
|
|
| func getCurFilters(c context.Context) []Filter {
|
| @@ -66,7 +66,7 @@ func getCurFilters(c context.Context) []Filter {
|
| return nil
|
| }
|
|
|
| -// AddFilters adds Interface filters to the context.
|
| +// AddFilters adds RawInterface filters to the context.
|
| func AddFilters(c context.Context, filts ...Filter) context.Context {
|
| if len(filts) == 0 {
|
| return c
|
|
|