|
|
@ -292,7 +292,7 @@ func modeRebuild(id string) (err error) {
|
|
|
|
|
|
|
|
|
|
|
|
for _, dboGMA2File := range dboGMA2Files {
|
|
|
|
for _, dboGMA2File := range dboGMA2Files {
|
|
|
|
//fmt.Printf("WriteFile for %s number %d = %s\n", dboGMA2File.FileName, dboGMA2File.FileNumber, dboGMA2File.UploadID)
|
|
|
|
//fmt.Printf("WriteFile for %s number %d = %s\n", dboGMA2File.FileName, dboGMA2File.FileNumber, dboGMA2File.UploadID)
|
|
|
|
resp, err := httpClient.Get(fmt.Sprintf("http://127.0.0.1:13371/fetch/%s", dboGMA2File.UploadID))
|
|
|
|
resp, err := httpClient.Get(fmt.Sprintf("http://192.168.133.118:13371/fetch/%s", dboGMA2File.UploadID))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -344,8 +344,11 @@ func recursive(jobs []string, folderPath string) (WorkerJobPool []string) {
|
|
|
|
if e.IsDir() {
|
|
|
|
if e.IsDir() {
|
|
|
|
jobs = recursive(jobs, fullPath)
|
|
|
|
jobs = recursive(jobs, fullPath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !e.IsDir() {
|
|
|
|
fmt.Println(e.Name())
|
|
|
|
jobs = append(jobs, filepath.Join(folderPath, e.Name()))
|
|
|
|
if strings.HasSuffix(e.Name(), ".gma") && !strings.Contains(e.Name(), ".lzma") {
|
|
|
|
|
|
|
|
if !e.IsDir() {
|
|
|
|
|
|
|
|
jobs = append(jobs, filepath.Join(folderPath, e.Name()))
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return jobs
|
|
|
|
return jobs
|
|
|
@ -364,8 +367,11 @@ func modeDelete(folderPath string) {
|
|
|
|
if e.IsDir() {
|
|
|
|
if e.IsDir() {
|
|
|
|
WorkerJobPool = recursive(WorkerJobPool, fullPath)
|
|
|
|
WorkerJobPool = recursive(WorkerJobPool, fullPath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !e.IsDir() {
|
|
|
|
fmt.Println(e.Name())
|
|
|
|
WorkerJobPool = append(WorkerJobPool, filepath.Join(folderPath, e.Name()))
|
|
|
|
if strings.HasSuffix(e.Name(), ".gma") && !strings.Contains(e.Name(), ".lzma") {
|
|
|
|
|
|
|
|
if !e.IsDir() {
|
|
|
|
|
|
|
|
WorkerJobPool = append(WorkerJobPool, filepath.Join(folderPath, e.Name()))
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wg := sync.WaitGroup{}
|
|
|
|
wg := sync.WaitGroup{}
|
|
|
@ -432,8 +438,11 @@ func modeIngress(folderPath string, skipN int) {
|
|
|
|
if e.IsDir() {
|
|
|
|
if e.IsDir() {
|
|
|
|
WorkerJobPool = recursive(WorkerJobPool, fullPath)
|
|
|
|
WorkerJobPool = recursive(WorkerJobPool, fullPath)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if !e.IsDir() {
|
|
|
|
fmt.Println(e.Name())
|
|
|
|
WorkerJobPool = append(WorkerJobPool, filepath.Join(folderPath, e.Name()))
|
|
|
|
if strings.HasSuffix(e.Name(), ".gma") && !strings.Contains(e.Name(), ".lzma") {
|
|
|
|
|
|
|
|
if !e.IsDir() {
|
|
|
|
|
|
|
|
WorkerJobPool = append(WorkerJobPool, filepath.Join(folderPath, e.Name()))
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if skipN > 0 {
|
|
|
|
if skipN > 0 {
|
|
|
@ -557,11 +566,11 @@ func DeleteIfSafeGMA(pw progress.Writer, filePath string) (err error) {
|
|
|
|
if dboGMA.GMASize < 200 {
|
|
|
|
if dboGMA.GMASize < 200 {
|
|
|
|
return fmt.Errorf("GMA File too small, skipping")
|
|
|
|
return fmt.Errorf("GMA File too small, skipping")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
niceName := filepath.Base(filePath)
|
|
|
|
//niceName := filepath.Base(filePath)
|
|
|
|
trackerProcessDoneMarker := sync.Once{}
|
|
|
|
//trackerProcessDoneMarker := sync.Once{}
|
|
|
|
trackerProcess := progress.Tracker{Message: fmt.Sprintf("Deleting %s", niceName), Total: 0, Units: progress.UnitsDefault}
|
|
|
|
//trackerProcess := progress.Tracker{Message: fmt.Sprintf("Deleting %s", niceName), Total: 0, Units: progress.UnitsDefault}
|
|
|
|
defer trackerProcessDoneMarker.Do(trackerProcess.MarkAsDone)
|
|
|
|
//defer trackerProcessDoneMarker.Do(trackerProcess.MarkAsDone)
|
|
|
|
pw.AppendTracker(&trackerProcess)
|
|
|
|
//pw.AppendTracker(&trackerProcess)
|
|
|
|
|
|
|
|
|
|
|
|
gmaReader, err := gma.NewReader(filePath)
|
|
|
|
gmaReader, err := gma.NewReader(filePath)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
@ -591,7 +600,15 @@ func DeleteIfSafeGMA(pw progress.Writer, filePath string) (err error) {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Printf("would delete %s\n", dboGMA.OriginalPath)
|
|
|
|
pw.Log("deleted %s", dboGMA.OriginalPath)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
lzmaFile := fmt.Sprintf("%s.lzma", dboGMA.OriginalPath)
|
|
|
|
|
|
|
|
if checkFileExists(lzmaFile) {
|
|
|
|
|
|
|
|
err = os.Remove(lzmaFile)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pw.Log("deleted %s", lzmaFile)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_, err = colGMA.UpdateDocument(arangoCTX, dboGMA.ID, common.DB_GMADeletionData{
|
|
|
|
_, err = colGMA.UpdateDocument(arangoCTX, dboGMA.ID, common.DB_GMADeletionData{
|
|
|
@ -855,7 +872,7 @@ func ProcessGMA(pw progress.Writer, filePath string) (err error) {
|
|
|
|
//dboFile2ChunkID := fmt.Sprintf("file_chunk_map/%s", dboFile.ID)
|
|
|
|
//dboFile2ChunkID := fmt.Sprintf("file_chunk_map/%s", dboFile.ID)
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Check against Storage backend
|
|
|
|
// TODO: Check against Storage backend
|
|
|
|
res, err := http.Get(fmt.Sprintf("http://127.0.0.1:13371/check/%s", dboFile.ID))
|
|
|
|
res, err := http.Get(fmt.Sprintf("http://192.168.133.118:13371/check/%s", dboFile.ID))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -912,7 +929,7 @@ func ProcessGMA(pw progress.Writer, filePath string) (err error) {
|
|
|
|
|
|
|
|
|
|
|
|
//uploadBar.Describe("Uploading")
|
|
|
|
//uploadBar.Describe("Uploading")
|
|
|
|
trackerUpload.UpdateMessage(fmt.Sprintf("Uploading %s", niceName))
|
|
|
|
trackerUpload.UpdateMessage(fmt.Sprintf("Uploading %s", niceName))
|
|
|
|
err = common.MultipartUpload(httpClient, fmt.Sprintf("http://127.0.0.1:13371/stash/%s/%d", dboGMA2File.UploadID, dboGMA2File.FileSize), dboGMA2File.LocalFileName, fileInfoJSON, workerID)
|
|
|
|
err = common.MultipartUpload(httpClient, fmt.Sprintf("http://192.168.133.118:13371/stash/%s/%d", dboGMA2File.UploadID, dboGMA2File.FileSize), dboGMA2File.LocalFileName, fileInfoJSON, workerID)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.Println("err @common.MultipartUpload")
|
|
|
|
log.Println("err @common.MultipartUpload")
|
|
|
|
log.Println(err)
|
|
|
|
log.Println(err)
|
|
|
@ -1042,7 +1059,7 @@ func ProcessGMA(pw progress.Writer, filePath string) (err error) {
|
|
|
|
|
|
|
|
|
|
|
|
for _, dboGMA2File := range rw_dboGMA2Files {
|
|
|
|
for _, dboGMA2File := range rw_dboGMA2Files {
|
|
|
|
//fmt.Printf("WriteFile for %s number %d = %s\n", dboGMA2File.FileName, dboGMA2File.FileNumber, dboGMA2File.UploadID)
|
|
|
|
//fmt.Printf("WriteFile for %s number %d = %s\n", dboGMA2File.FileName, dboGMA2File.FileNumber, dboGMA2File.UploadID)
|
|
|
|
resp, err := httpClient.Get(fmt.Sprintf("http://127.0.0.1:13371/fetch/%s", dboGMA2File.UploadID))
|
|
|
|
resp, err := httpClient.Get(fmt.Sprintf("http://192.168.133.118:13371/fetch/%s", dboGMA2File.UploadID))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
undoBatch(true, dboGMA.ID, fileIDs, gma2FileIDs)
|
|
|
|
undoBatch(true, dboGMA.ID, fileIDs, gma2FileIDs)
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|