mirror of https://github.com/containers/podman.git
				
				
				
			Add pod buckets
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #184 Approved by: baude
This commit is contained in:
		
							parent
							
								
									b4cdc27b31
								
							
						
					
					
						commit
						363a82e668
					
				|  | @ -69,6 +69,14 @@ func NewBoltState(path, lockDir string, runtime *Runtime) (State, error) { | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return errors.Wrapf(err, "error creating container-depends bucket") | 			return errors.Wrapf(err, "error creating container-depends bucket") | ||||||
| 		} | 		} | ||||||
|  | 		_, err = tx.CreateBucketIfNotExists(podBkt) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return errors.Wrapf(err, "error creating pod bucket") | ||||||
|  | 		} | ||||||
|  | 		_, err = tx.CreateBucketIfNotExists(podContainersBkt) | ||||||
|  | 		if err != nil { | ||||||
|  | 			return errors.Wrapf(err, "error creating pod-containers bucket") | ||||||
|  | 		} | ||||||
| 		return nil | 		return nil | ||||||
| 	}) | 	}) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|  |  | ||||||
|  | @ -17,6 +17,8 @@ const ( | ||||||
| 	netNSName         = "net-ns" | 	netNSName         = "net-ns" | ||||||
| 	runtimeConfigName = "runtime-config" | 	runtimeConfigName = "runtime-config" | ||||||
| 	ctrDependsName    = "container-depends" | 	ctrDependsName    = "container-depends" | ||||||
|  | 	podName           = "pod" | ||||||
|  | 	podContainersName = "pod-containers" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| var ( | var ( | ||||||
|  | @ -27,6 +29,8 @@ var ( | ||||||
| 	netNSBkt         = []byte(netNSName) | 	netNSBkt         = []byte(netNSName) | ||||||
| 	runtimeConfigBkt = []byte(runtimeConfigName) | 	runtimeConfigBkt = []byte(runtimeConfigName) | ||||||
| 	ctrDependsBkt    = []byte(ctrDependsName) | 	ctrDependsBkt    = []byte(ctrDependsName) | ||||||
|  | 	podBkt           = []byte(podName) | ||||||
|  | 	podContainersBkt = []byte(podContainersName) | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // Check if the configuration of the database is compatible with the
 | // Check if the configuration of the database is compatible with the
 | ||||||
|  | @ -158,6 +162,22 @@ func getCtrDependsBucket(tx *bolt.Tx) (*bolt.Bucket, error) { | ||||||
| 	return bkt, nil | 	return bkt, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func getPodBucket(tx *bolt.Tx) (*bolt.Bucket, error) { | ||||||
|  | 	bkt := tx.Bucket(podBkt) | ||||||
|  | 	if bkt == nil { | ||||||
|  | 		return nil, errors.Wrapf(ErrDBBadConfig, "pods bucket not found in DB") | ||||||
|  | 	} | ||||||
|  | 	return bkt, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | func getPodContainersBucket(tx *bolt.Tx) (*bolt.Bucket, error) { | ||||||
|  | 	bkt := tx.Bucket(podContainersBkt) | ||||||
|  | 	if bkt == nil { | ||||||
|  | 		return nil, errors.Wrapf(ErrDBBadConfig, "pod containers bucket not found in DB") | ||||||
|  | 	} | ||||||
|  | 	return bkt, nil | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func (s *BoltState) getContainerFromDB(id []byte, ctr *Container, config, state, netNS *bolt.Bucket) error { | func (s *BoltState) getContainerFromDB(id []byte, ctr *Container, config, state, netNS *bolt.Bucket) error { | ||||||
| 	configBytes := config.Get(id) | 	configBytes := config.Get(id) | ||||||
| 	if configBytes == nil { | 	if configBytes == nil { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue