Refactor server sandbox

Make sandbox struct and it methods public, and add accessor methods
for the struct fields

Signed-off-by: Ryan Cole <rcyoalne@gmail.com>
This commit is contained in:
Ryan Cole 2017-07-18 16:35:15 -04:00
parent a82cc428a9
commit 3ddf2efae2
6 changed files with 198 additions and 33 deletions

View file

@ -30,7 +30,7 @@ func filterSandbox(p *pb.PodSandbox, filter *pb.PodSandboxFilter) bool {
func (s *Server) ListPodSandbox(ctx context.Context, req *pb.ListPodSandboxRequest) (*pb.ListPodSandboxResponse, error) {
logrus.Debugf("ListPodSandboxRequest %+v", req)
var pods []*pb.PodSandbox
var podList []*sandbox
var podList []*Sandbox
for _, sb := range s.state.sandboxes {
podList = append(podList, sb)
}
@ -45,9 +45,9 @@ func (s *Server) ListPodSandbox(ctx context.Context, req *pb.ListPodSandboxReque
}
sb := s.getSandbox(id)
if sb == nil {
podList = []*sandbox{}
podList = []*Sandbox{}
} else {
podList = []*sandbox{sb}
podList = []*Sandbox{sb}
}
}
}