netbs: Drop client code for allkeys for now
This commit is contained in:
parent
401359646a
commit
53e43a402a
@ -24,7 +24,6 @@ const (
|
|||||||
NRpcGetSize
|
NRpcGetSize
|
||||||
NRpcPut
|
NRpcPut
|
||||||
NRpcDelete
|
NRpcDelete
|
||||||
NRpcList
|
|
||||||
|
|
||||||
// todo cancel req
|
// todo cancel req
|
||||||
)
|
)
|
||||||
@ -403,49 +402,7 @@ func (n *NetworkStore) DeleteMany(ctx context.Context, cids []cid.Cid) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *NetworkStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
|
func (n *NetworkStore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
|
||||||
req, rch, err := n.sendRpc(NRpcList, nil, nil)
|
return nil, xerrors.Errorf("not supported")
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
outCh := make(chan cid.Cid, 16)
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
defer close(outCh)
|
|
||||||
// todo defer cancel request
|
|
||||||
|
|
||||||
for {
|
|
||||||
if rch == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := n.waitResp(ctx, rch, req)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
switch resp.Type {
|
|
||||||
case NRpcOK, NRpcMore:
|
|
||||||
c, err := cid.Cast(resp.Data)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo propagate backpressure
|
|
||||||
select {
|
|
||||||
case outCh <- c:
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
rch = resp.next
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
return outCh, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *NetworkStore) HashOnRead(enabled bool) {
|
func (n *NetworkStore) HashOnRead(enabled bool) {
|
||||||
|
@ -175,8 +175,8 @@ func (h *NetworkStoreHandler) handle(ctx context.Context) {
|
|||||||
log.Warnw("writing response", "error", err)
|
log.Warnw("writing response", "error", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case NRpcList:
|
default:
|
||||||
if err := h.respondError(req.ID, xerrors.New("list todo"), cid.Undef); err != nil {
|
if err := h.respondError(req.ID, xerrors.New("unsupported request type"), cid.Undef); err != nil {
|
||||||
log.Warnw("writing error response", "error", err)
|
log.Warnw("writing error response", "error", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user