mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Volumes refactor and external plugin implementation.
Signed by all authors: Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com> Signed-off-by: David Calavera <david.calavera@gmail.com> Signed-off-by: Jeff Lindsay <progrium@gmail.com> Signed-off-by: Alexander Morozov <lk4d4@docker.com> Signed-off-by: Luke Marsden <luke@clusterhq.com> Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
		
							parent
							
								
									23e8dff9e7
								
							
						
					
					
						commit
						81fa9feb0c
					
				
					 43 changed files with 1538 additions and 1191 deletions
				
			
		
							
								
								
									
										65
									
								
								volume/drivers/proxy.go
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								volume/drivers/proxy.go
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,65 @@
 | 
			
		|||
package volumedrivers
 | 
			
		||||
 | 
			
		||||
// currently created by hand. generation tool would generate this like:
 | 
			
		||||
// $ rpc-gen volume/drivers/api.go VolumeDriver > volume/drivers/proxy.go
 | 
			
		||||
 | 
			
		||||
type volumeDriverRequest struct {
 | 
			
		||||
	Name string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type volumeDriverResponse struct {
 | 
			
		||||
	Mountpoint string `json:",ommitempty"`
 | 
			
		||||
	Err        error  `json:",ommitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type volumeDriverProxy struct {
 | 
			
		||||
	c client
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (pp *volumeDriverProxy) Create(name string) error {
 | 
			
		||||
	args := volumeDriverRequest{name}
 | 
			
		||||
	var ret volumeDriverResponse
 | 
			
		||||
	err := pp.c.Call("VolumeDriver.Create", args, &ret)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return ret.Err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (pp *volumeDriverProxy) Remove(name string) error {
 | 
			
		||||
	args := volumeDriverRequest{name}
 | 
			
		||||
	var ret volumeDriverResponse
 | 
			
		||||
	err := pp.c.Call("VolumeDriver.Remove", args, &ret)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return ret.Err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (pp *volumeDriverProxy) Path(name string) (string, error) {
 | 
			
		||||
	args := volumeDriverRequest{name}
 | 
			
		||||
	var ret volumeDriverResponse
 | 
			
		||||
	if err := pp.c.Call("VolumeDriver.Path", args, &ret); err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	return ret.Mountpoint, ret.Err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (pp *volumeDriverProxy) Mount(name string) (string, error) {
 | 
			
		||||
	args := volumeDriverRequest{name}
 | 
			
		||||
	var ret volumeDriverResponse
 | 
			
		||||
	if err := pp.c.Call("VolumeDriver.Mount", args, &ret); err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	return ret.Mountpoint, ret.Err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (pp *volumeDriverProxy) Unmount(name string) error {
 | 
			
		||||
	args := volumeDriverRequest{name}
 | 
			
		||||
	var ret volumeDriverResponse
 | 
			
		||||
	err := pp.c.Call("VolumeDriver.Unmount", args, &ret)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	return ret.Err
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue