| 
									
										
										
										
											2021-02-07 06:49:40 +08:00
										 |  |  | package define | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"fmt" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type Isolation int | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const ( | 
					
						
							|  |  |  | 	// IsolationDefault is whatever we think will work best.
 | 
					
						
							|  |  |  | 	IsolationDefault Isolation = iota | 
					
						
							|  |  |  | 	// IsolationOCI is a proper OCI runtime.
 | 
					
						
							|  |  |  | 	IsolationOCI | 
					
						
							|  |  |  | 	// IsolationChroot is a more chroot-like environment: less isolation,
 | 
					
						
							|  |  |  | 	// but with fewer requirements.
 | 
					
						
							|  |  |  | 	IsolationChroot | 
					
						
							|  |  |  | 	// IsolationOCIRootless is a proper OCI runtime in rootless mode.
 | 
					
						
							|  |  |  | 	IsolationOCIRootless | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // String converts a Isolation into a string.
 | 
					
						
							|  |  |  | func (i Isolation) String() string { | 
					
						
							|  |  |  | 	switch i { | 
					
						
							| 
									
										
										
										
											2021-02-23 20:27:24 +08:00
										 |  |  | 	case IsolationDefault, IsolationOCI: | 
					
						
							|  |  |  | 		return "oci" | 
					
						
							| 
									
										
										
										
											2021-02-07 06:49:40 +08:00
										 |  |  | 	case IsolationChroot: | 
					
						
							| 
									
										
										
										
											2021-02-23 20:27:24 +08:00
										 |  |  | 		return "chroot" | 
					
						
							| 
									
										
										
										
											2021-02-07 06:49:40 +08:00
										 |  |  | 	case IsolationOCIRootless: | 
					
						
							| 
									
										
										
										
											2021-02-23 20:27:24 +08:00
										 |  |  | 		return "rootless" | 
					
						
							| 
									
										
										
										
											2021-02-07 06:49:40 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	return fmt.Sprintf("unrecognized isolation type %d", i) | 
					
						
							|  |  |  | } |