Index: impl/cloud/context.go |
diff --git a/impl/cloud/context.go b/impl/cloud/context.go |
index a4b19ea6990e1adbece421ee9dc7bafed5d184c6..bd8fa8e1ad82fc977fc6f2109529acf327c4bb8f 100644 |
--- a/impl/cloud/context.go |
+++ b/impl/cloud/context.go |
@@ -51,10 +51,7 @@ func (cfg Config) Use(c context.Context) context.Context { |
// datastore service |
if cfg.DS != nil { |
- cds := cloudDatastore{ |
- client: cfg.DS, |
- } |
- c = cds.use(c) |
+ c = UseDatastore(c, cfg.DS) |
} else { |
c = ds.SetRaw(c, dummy.Datastore()) |
} |
@@ -71,3 +68,11 @@ func (cfg Config) Use(c context.Context) context.Context { |
return c |
} |
+ |
+// UseDatastore installs a datastore implementation into the context. |
+func UseDatastore(c context.Context, client *datastore.Client) context.Context { |
+ cds := cloudDatastore{ |
+ client: client, |
+ } |
+ return cds.use(c) |
+} |