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

Side by Side Diff: filters/count/rds.go

Issue 1247283003: Improve docs (Closed) Base URL: https://github.com/luci/gae.git@reduce_size
Patch Set: fix comments 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 unified diff | Download patch
« no previous file with comments | « filters/count/mc.go ('k') | filters/count/tq.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package count
6
7 import (
8 "golang.org/x/net/context"
9
10 rds "github.com/luci/gae/service/rawdatastore"
11 )
12
13 // RDSCounter is the counter object for the RawDatastore service.
14 type RDSCounter struct {
15 NewKey Entry
16 DecodeKey Entry
17 NewQuery Entry
18 Count Entry
19 RunInTransaction Entry
20 Run Entry
21 GetAll Entry
22 Put Entry
23 Get Entry
24 Delete Entry
25 DeleteMulti Entry
26 GetMulti Entry
27 PutMulti Entry
28 }
29
30 type rdsCounter struct {
31 c *RDSCounter
32
33 rds rds.Interface
34 }
35
36 var _ rds.Interface = (*rdsCounter)(nil)
37
38 func (r *rdsCounter) NewKey(kind, stringID string, intID int64, parent rds.Key) rds.Key {
39 r.c.NewKey.up()
40 return r.rds.NewKey(kind, stringID, intID, parent)
41 }
42
43 func (r *rdsCounter) DecodeKey(encoded string) (rds.Key, error) {
44 ret, err := r.rds.DecodeKey(encoded)
45 return ret, r.c.DecodeKey.up(err)
46 }
47
48 func (r *rdsCounter) NewQuery(kind string) rds.Query {
49 r.c.NewQuery.up()
50 return r.rds.NewQuery(kind)
51 }
52
53 func (r *rdsCounter) Run(q rds.Query) rds.Iterator {
54 r.c.Run.up()
55 return r.rds.Run(q)
56 }
57
58 func (r *rdsCounter) GetAll(q rds.Query, dst *[]rds.PropertyMap) ([]rds.Key, err or) {
59 ret, err := r.rds.GetAll(q, dst)
60 return ret, r.c.GetAll.up(err)
61 }
62
63 func (r *rdsCounter) Count(q rds.Query) (int, error) {
64 ret, err := r.rds.Count(q)
65 return ret, r.c.Count.up(err)
66 }
67
68 func (r *rdsCounter) RunInTransaction(f func(context.Context) error, opts *rds.T ransactionOptions) error {
69 return r.c.RunInTransaction.up(r.rds.RunInTransaction(f, opts))
70 }
71
72 func (r *rdsCounter) Put(key rds.Key, src rds.PropertyLoadSaver) (rds.Key, error ) {
73 ret, err := r.rds.Put(key, src)
74 return ret, r.c.Put.up(err)
75 }
76
77 func (r *rdsCounter) Get(key rds.Key, dst rds.PropertyLoadSaver) error {
78 return r.c.Get.up(r.rds.Get(key, dst))
79 }
80
81 func (r *rdsCounter) Delete(key rds.Key) error {
82 return r.c.Delete.up(r.rds.Delete(key))
83 }
84
85 func (r *rdsCounter) DeleteMulti(keys []rds.Key) error {
86 return r.c.DeleteMulti.up(r.rds.DeleteMulti(keys))
87 }
88
89 func (r *rdsCounter) GetMulti(keys []rds.Key, dst []rds.PropertyLoadSaver) error {
90 return r.c.GetMulti.up(r.rds.GetMulti(keys, dst))
91 }
92
93 func (r *rdsCounter) PutMulti(keys []rds.Key, src []rds.PropertyLoadSaver) ([]rd s.Key, error) {
94 ret, err := r.rds.PutMulti(keys, src)
95 return ret, r.c.PutMulti.up(err)
96 }
97
98 // FilterRDS installs a counter RawDatastore filter in the context.
99 func FilterRDS(c context.Context) (context.Context, *RDSCounter) {
100 state := &RDSCounter{}
101 return rds.AddFilters(c, func(ic context.Context, rds rds.Interface) rds .Interface {
102 return &rdsCounter{state, rds}
103 }), state
104 }
OLDNEW
« no previous file with comments | « filters/count/mc.go ('k') | filters/count/tq.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698