@@ -27,7 +27,7 @@ func NewMapDatastore() (d *MapDatastore) {
27
27
}
28
28
29
29
// Put implements Datastore.Put
30
- func (d * MapDatastore ) Put (ctx context.Context , key Key , value []byte ) ( err error ) {
30
+ func (d * MapDatastore ) Put (ctx context.Context , key Key , value []byte ) error {
31
31
d .values [key ] = value
32
32
return nil
33
33
}
@@ -38,7 +38,7 @@ func (d *MapDatastore) Sync(ctx context.Context, prefix Key) error {
38
38
}
39
39
40
40
// Get implements Datastore.Get
41
- func (d * MapDatastore ) Get (ctx context.Context , key Key ) (value []byte , err error ) {
41
+ func (d * MapDatastore ) Get (ctx context.Context , key Key ) ([]byte , error ) {
42
42
val , found := d .values [key ]
43
43
if ! found {
44
44
return nil , ErrNotFound
@@ -47,21 +47,21 @@ func (d *MapDatastore) Get(ctx context.Context, key Key) (value []byte, err erro
47
47
}
48
48
49
49
// Has implements Datastore.Has
50
- func (d * MapDatastore ) Has (ctx context.Context , key Key ) (exists bool , err error ) {
50
+ func (d * MapDatastore ) Has (ctx context.Context , key Key ) (bool , error ) {
51
51
_ , found := d .values [key ]
52
52
return found , nil
53
53
}
54
54
55
55
// GetSize implements Datastore.GetSize
56
- func (d * MapDatastore ) GetSize (ctx context.Context , key Key ) (size int , err error ) {
56
+ func (d * MapDatastore ) GetSize (ctx context.Context , key Key ) (int , error ) {
57
57
if v , found := d .values [key ]; found {
58
58
return len (v ), nil
59
59
}
60
60
return - 1 , ErrNotFound
61
61
}
62
62
63
63
// Delete implements Datastore.Delete
64
- func (d * MapDatastore ) Delete (ctx context.Context , key Key ) ( err error ) {
64
+ func (d * MapDatastore ) Delete (ctx context.Context , key Key ) error {
65
65
delete (d .values , key )
66
66
return nil
67
67
}
@@ -124,7 +124,7 @@ func (d *LogDatastore) Children() []Datastore {
124
124
}
125
125
126
126
// Put implements Datastore.Put
127
- func (d * LogDatastore ) Put (ctx context.Context , key Key , value []byte ) ( err error ) {
127
+ func (d * LogDatastore ) Put (ctx context.Context , key Key , value []byte ) error {
128
128
log .Printf ("%s: Put %s\n " , d .Name , key )
129
129
// log.Printf("%s: Put %s ```%s```", d.Name, key, value)
130
130
return d .child .Put (ctx , key , value )
@@ -137,25 +137,25 @@ func (d *LogDatastore) Sync(ctx context.Context, prefix Key) error {
137
137
}
138
138
139
139
// Get implements Datastore.Get
140
- func (d * LogDatastore ) Get (ctx context.Context , key Key ) (value []byte , err error ) {
140
+ func (d * LogDatastore ) Get (ctx context.Context , key Key ) ([]byte , error ) {
141
141
log .Printf ("%s: Get %s\n " , d .Name , key )
142
142
return d .child .Get (ctx , key )
143
143
}
144
144
145
145
// Has implements Datastore.Has
146
- func (d * LogDatastore ) Has (ctx context.Context , key Key ) (exists bool , err error ) {
146
+ func (d * LogDatastore ) Has (ctx context.Context , key Key ) (bool , error ) {
147
147
log .Printf ("%s: Has %s\n " , d .Name , key )
148
148
return d .child .Has (ctx , key )
149
149
}
150
150
151
151
// GetSize implements Datastore.GetSize
152
- func (d * LogDatastore ) GetSize (ctx context.Context , key Key ) (size int , err error ) {
152
+ func (d * LogDatastore ) GetSize (ctx context.Context , key Key ) (int , error ) {
153
153
log .Printf ("%s: GetSize %s\n " , d .Name , key )
154
154
return d .child .GetSize (ctx , key )
155
155
}
156
156
157
157
// Delete implements Datastore.Delete
158
- func (d * LogDatastore ) Delete (ctx context.Context , key Key ) ( err error ) {
158
+ func (d * LogDatastore ) Delete (ctx context.Context , key Key ) error {
159
159
log .Printf ("%s: Delete %s\n " , d .Name , key )
160
160
return d .child .Delete (ctx , key )
161
161
}
@@ -203,20 +203,20 @@ func (d *LogDatastore) Batch(ctx context.Context) (Batch, error) {
203
203
}
204
204
205
205
// Put implements Batch.Put
206
- func (d * LogBatch ) Put (ctx context.Context , key Key , value []byte ) ( err error ) {
206
+ func (d * LogBatch ) Put (ctx context.Context , key Key , value []byte ) error {
207
207
log .Printf ("%s: BatchPut %s\n " , d .Name , key )
208
208
// log.Printf("%s: Put %s ```%s```", d.Name, key, value)
209
209
return d .child .Put (ctx , key , value )
210
210
}
211
211
212
212
// Delete implements Batch.Delete
213
- func (d * LogBatch ) Delete (ctx context.Context , key Key ) ( err error ) {
213
+ func (d * LogBatch ) Delete (ctx context.Context , key Key ) error {
214
214
log .Printf ("%s: BatchDelete %s\n " , d .Name , key )
215
215
return d .child .Delete (ctx , key )
216
216
}
217
217
218
218
// Commit implements Batch.Commit
219
- func (d * LogBatch ) Commit (ctx context.Context ) ( err error ) {
219
+ func (d * LogBatch ) Commit (ctx context.Context ) error {
220
220
log .Printf ("%s: BatchCommit\n " , d .Name )
221
221
return d .child .Commit (ctx )
222
222
}
0 commit comments