| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -3,7 +3,6 @@ package Filesystem | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import ( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						"os" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						"path/filepath" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						"strings" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						"github.com/vbauerster/mpb" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						bolt "go.etcd.io/bbolt" | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -13,7 +12,7 @@ import ( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						"PackageManager/Variables" | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					func pickFilesSingle(fileKey, filePath string) error { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					func pickFilesSingle(filePath string) error { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						var ( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							indexBucket *bolt.Bucket | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							picksBucket *bolt.Bucket | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -24,11 +23,11 @@ func pickFilesSingle(fileKey, filePath string) error { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							indexBucket = tx.Bucket(Variables.FsHashIndexBucket) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							picksBucket = tx.Bucket(Variables.FsHashPicksBucket) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							e = AddFileToBucket(picksBucket, fileKey, filePath) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							e = AddFileToBucket(picksBucket, filePath) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if e != nil { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								return e | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return RemoveFileFromBucket(indexBucket, fileKey) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return RemoveFileFromBucket(indexBucket, filePath) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						}) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						return e | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -40,7 +39,6 @@ func pickFilesRecursive(rootPath string) error { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							picksBucket *bolt.Bucket | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							bar         *mpb.Bar | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							totalLen    int | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							trimF       string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							f           string | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							e           error | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						) | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -65,8 +63,7 @@ func pickFilesRecursive(rootPath string) error { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if len(fsStatus.NewFiles) > 0 { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								for _, f = range fsStatus.NewFiles { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									bar.Increment() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									trimF = strings.TrimPrefix(f, Variables.RootDir) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									e = AddFileToBucket(picksBucket, trimF, f) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									e = AddFileToBucket(picksBucket, f) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									if e != nil { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										return e | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -76,8 +73,7 @@ func pickFilesRecursive(rootPath string) error { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if len(fsStatus.ModifiedFiles) > 0 { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								for _, f = range fsStatus.ModifiedFiles { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									bar.Increment() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									trimF = strings.TrimPrefix(f, Variables.RootDir) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									e = AddFileToBucket(picksBucket, trimF, f) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									e = AddFileToBucket(picksBucket, f) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									if e != nil { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										return e | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									} | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -119,7 +115,7 @@ func PickFiles(rootPath string) error { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						if !rootStat.IsDir() { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return pickFilesSingle(rootPath, realRootPath) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return pickFilesSingle(realRootPath) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						return pickFilesRecursive(realRootPath) | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |