// GetResponse looks up a response matching the specified cmdID. If the // response is found, it is returned along with its associated error. // If the response is not found, nil is returned for both the response // and its error. In all cases, the third return value is the error // returned from the engine when reading the on-disk cache. func (rc *ResponseCache) GetResponse(e engine.Engine, cmdID proto.ClientCmdID) (proto.ResponseWithError, error) { // Do nothing if command ID is empty. if cmdID.IsEmpty() { return proto.ResponseWithError{}, nil } // Pull response from the cache and read into reply if available. var rcEntry proto.ResponseCacheEntry key := keys.ResponseCacheKey(rc.rangeID, &cmdID) ok, err := engine.MVCCGetProto(e, key, proto.ZeroTimestamp, true, nil, &rcEntry) if err != nil { return proto.ResponseWithError{}, err } if ok { resp := rcEntry.GetValue().(proto.Response) header := resp.Header() defer func() { header.Error = nil }() return proto.ResponseWithError{Reply: resp, Err: header.GoError()}, nil } return proto.ResponseWithError{}, nil }