(pindexName string, w http.ResponseWriter, req *http.Request)
| 112 | } |
| 113 | |
| 114 | func (h *PIndexContentHandler) streamPIndexContents(pindexName string, |
| 115 | w http.ResponseWriter, req *http.Request) { |
| 116 | pindexPath := h.mgr.PIndexPath(pindexName) |
| 117 | _, err := ioutil.ReadDir(pindexPath) |
| 118 | if err != nil { |
| 119 | rest.ShowError(w, req, fmt.Sprintf("rest_pindex_streamer:"+ |
| 120 | " read failed for path: %s, err: %v", pindexPath, err), |
| 121 | http.StatusInternalServerError) |
| 122 | return |
| 123 | } |
| 124 | |
| 125 | size, err := cbgt.GetDirectorySize(pindexPath) |
| 126 | if err != nil { |
| 127 | rest.ShowError(w, req, fmt.Sprintf("rest_pindex_streamer:"+ |
| 128 | " GetDirectorySize failed for path: %s, err: %v", |
| 129 | pindexPath, err), http.StatusInternalServerError) |
| 130 | return |
| 131 | } |
| 132 | |
| 133 | w.Header().Set("Content-Size", strconv.Itoa(int(size))) |
| 134 | w.Header().Set("Content-Type", "application/x-tar") |
| 135 | w.Header().Set("Trailer", "Checksum") |
| 136 | |
| 137 | h.streamTarArchive(pindexName, w, req) |
| 138 | } |
| 139 | |
| 140 | func (h *PIndexContentHandler) streamTarArchive(pindexName string, |
| 141 | w http.ResponseWriter, req *http.Request) { |
no test coverage detected