@@ -27,7 +27,7 @@ func NewMapDatastore() (d *MapDatastore) {
2727}
2828
2929// 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 {
3131 d .values [key ] = value
3232 return nil
3333}
@@ -38,7 +38,7 @@ func (d *MapDatastore) Sync(ctx context.Context, prefix Key) error {
3838}
3939
4040// 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 ) {
4242 val , found := d .values [key ]
4343 if ! found {
4444 return nil , ErrNotFound
@@ -47,21 +47,21 @@ func (d *MapDatastore) Get(ctx context.Context, key Key) (value []byte, err erro
4747}
4848
4949// 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 ) {
5151 _ , found := d .values [key ]
5252 return found , nil
5353}
5454
5555// 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 ) {
5757 if v , found := d .values [key ]; found {
5858 return len (v ), nil
5959 }
6060 return - 1 , ErrNotFound
6161}
6262
6363// 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 {
6565 delete (d .values , key )
6666 return nil
6767}
@@ -124,7 +124,7 @@ func (d *LogDatastore) Children() []Datastore {
124124}
125125
126126// 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 {
128128 log .Printf ("%s: Put %s\n " , d .Name , key )
129129 // log.Printf("%s: Put %s ```%s```", d.Name, key, value)
130130 return d .child .Put (ctx , key , value )
@@ -137,25 +137,25 @@ func (d *LogDatastore) Sync(ctx context.Context, prefix Key) error {
137137}
138138
139139// 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 ) {
141141 log .Printf ("%s: Get %s\n " , d .Name , key )
142142 return d .child .Get (ctx , key )
143143}
144144
145145// 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 ) {
147147 log .Printf ("%s: Has %s\n " , d .Name , key )
148148 return d .child .Has (ctx , key )
149149}
150150
151151// 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 ) {
153153 log .Printf ("%s: GetSize %s\n " , d .Name , key )
154154 return d .child .GetSize (ctx , key )
155155}
156156
157157// 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 {
159159 log .Printf ("%s: Delete %s\n " , d .Name , key )
160160 return d .child .Delete (ctx , key )
161161}
@@ -203,20 +203,20 @@ func (d *LogDatastore) Batch(ctx context.Context) (Batch, error) {
203203}
204204
205205// 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 {
207207 log .Printf ("%s: BatchPut %s\n " , d .Name , key )
208208 // log.Printf("%s: Put %s ```%s```", d.Name, key, value)
209209 return d .child .Put (ctx , key , value )
210210}
211211
212212// 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 {
214214 log .Printf ("%s: BatchDelete %s\n " , d .Name , key )
215215 return d .child .Delete (ctx , key )
216216}
217217
218218// Commit implements Batch.Commit
219- func (d * LogBatch ) Commit (ctx context.Context ) ( err error ) {
219+ func (d * LogBatch ) Commit (ctx context.Context ) error {
220220 log .Printf ("%s: BatchCommit\n " , d .Name )
221221 return d .child .Commit (ctx )
222222}
0 commit comments