| 
									
										
										
										
											2016-07-07 02:59:55 +08:00
										 |  |  | package sftp | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-09 05:13:03 +08:00
										 |  |  | import ( | 
					
						
							|  |  |  | 	"io" | 
					
						
							|  |  |  | 	"os" | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2016-07-09 03:38:35 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-09 05:13:03 +08:00
										 |  |  | // Interfaces are differentiated based on required returned values.
 | 
					
						
							|  |  |  | // All input arguments are to be pulled from Request (the only arg).
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // should return an io.Reader for the filepath
 | 
					
						
							|  |  |  | type FileReader interface { | 
					
						
							| 
									
										
										
										
											2016-07-12 02:16:08 +08:00
										 |  |  | 	Fileread(*Request) (io.Reader, error) | 
					
						
							| 
									
										
										
										
											2016-07-09 05:13:03 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // should return an io.Writer for the filepath
 | 
					
						
							|  |  |  | type FileWriter interface { | 
					
						
							| 
									
										
										
										
											2016-07-12 02:16:08 +08:00
										 |  |  | 	Filewrite(*Request) (io.Writer, error) | 
					
						
							| 
									
										
										
										
											2016-07-09 05:13:03 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // should return an error (rename, remove, setstate, etc.)
 | 
					
						
							|  |  |  | type FileCmder interface { | 
					
						
							| 
									
										
										
										
											2016-07-09 08:22:52 +08:00
										 |  |  | 	Filecmd(*Request) error | 
					
						
							| 
									
										
										
										
											2016-07-09 05:13:03 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // should return file listing info and errors (readdir, stat)
 | 
					
						
							|  |  |  | // note stat requests would return a list of 1
 | 
					
						
							|  |  |  | type FileInfoer interface { | 
					
						
							| 
									
										
										
										
											2016-07-09 08:22:52 +08:00
										 |  |  | 	Fileinfo(*Request) ([]os.FileInfo, error) | 
					
						
							| 
									
										
										
										
											2016-07-09 05:13:03 +08:00
										 |  |  | } |