Change store.Sync to store.List

This commit is contained in:
Asim Aslam
2019-10-23 22:05:39 +01:00
parent ecac392dbe
commit 82f94c7861
10 changed files with 216 additions and 220 deletions

View File

@@ -55,19 +55,19 @@ func (s *Store) Delete(ctx context.Context, req *pb.DeleteRequest, rsp *pb.Delet
return nil
}
func (s *Store) Sync(ctx context.Context, req *pb.SyncRequest, stream pb.Store_SyncStream) error {
func (s *Store) List(ctx context.Context, req *pb.ListRequest, stream pb.Store_ListStream) error {
var vals []*store.Record
var err error
if len(req.Key) > 0 {
vals, err = s.Store.Read(req.Key)
} else {
vals, err = s.Store.Sync()
vals, err = s.Store.List()
}
if err != nil {
return errors.InternalServerError("go.micro.store", err.Error())
}
rsp := new(pb.SyncResponse)
rsp := new(pb.ListResponse)
// TODO: batch sync
for _, val := range vals {