Rename prepare to unpack and init to prepare

Unpack and prepare better map to the actions done by rootfs.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
Derek McGowan 2017-03-14 23:34:32 -07:00
parent 340e56ecd0
commit b1bc82726f
No known key found for this signature in database
GPG key ID: F58C5D0A4405ACDB
8 changed files with 164 additions and 158 deletions

View file

@ -43,13 +43,13 @@ func (s *Service) Register(gs *grpc.Server) error {
return nil
}
func (s *Service) Prepare(ctx context.Context, pr *rootfsapi.PrepareRequest) (*rootfsapi.PrepareResponse, error) {
func (s *Service) Unpack(ctx context.Context, pr *rootfsapi.UnpackRequest) (*rootfsapi.UnpackResponse, error) {
layers := make([]ocispec.Descriptor, len(pr.Layers))
for i, l := range pr.Layers {
layers[i] = ocispec.Descriptor{
MediaType: l.MediaType,
Digest: l.Digest,
Size: l.MediaSize,
Size: l.Size_,
}
}
log.G(ctx).Infof("Preparing %#v", layers)
@ -59,12 +59,12 @@ func (s *Service) Prepare(ctx context.Context, pr *rootfsapi.PrepareRequest) (*r
return nil, err
}
log.G(ctx).Infof("ChainID %#v", chainID)
return &rootfsapi.PrepareResponse{
return &rootfsapi.UnpackResponse{
ChainID: chainID,
}, nil
}
func (s *Service) InitMounts(ctx context.Context, ir *rootfsapi.InitMountsRequest) (*rootfsapi.MountResponse, error) {
func (s *Service) Prepare(ctx context.Context, ir *rootfsapi.PrepareRequest) (*rootfsapi.MountResponse, error) {
mounts, err := rootfs.InitRootFS(ctx, ir.Name, ir.ChainID, ir.Readonly, s.snapshotter, mounter{})
if err != nil {
return nil, err