2016-07-08 19:04:00 +00:00
|
|
|
package server
|
|
|
|
|
2016-07-29 22:35:10 +00:00
|
|
|
import (
|
|
|
|
"github.com/mrunalp/ocid/oci"
|
|
|
|
)
|
|
|
|
|
2016-07-19 18:53:57 +00:00
|
|
|
const (
|
|
|
|
runtimeAPIVersion = "v1alpha1"
|
2016-07-08 19:04:00 +00:00
|
|
|
)
|
|
|
|
|
2016-07-19 18:53:57 +00:00
|
|
|
// Server implements the RuntimeService and ImageService
|
|
|
|
type Server struct {
|
2016-07-29 22:35:10 +00:00
|
|
|
runtime *oci.Runtime
|
|
|
|
sandboxes []*sandbox
|
2016-07-08 19:04:00 +00:00
|
|
|
}
|
|
|
|
|
2016-07-19 18:53:57 +00:00
|
|
|
// New creates a new Server with options provided
|
2016-08-01 22:08:21 +00:00
|
|
|
func New(runtimePath, sandboxDir, containerDir string) (*Server, error) {
|
|
|
|
r, err := oci.New(runtimePath, sandboxDir, containerDir)
|
2016-07-19 18:53:57 +00:00
|
|
|
if err != nil {
|
2016-07-29 22:35:10 +00:00
|
|
|
return nil, err
|
2016-07-19 18:53:57 +00:00
|
|
|
}
|
2016-07-29 22:35:10 +00:00
|
|
|
return &Server{
|
|
|
|
runtime: r,
|
|
|
|
}, nil
|
2016-07-08 19:04:00 +00:00
|
|
|
}
|
2016-07-20 01:30:05 +00:00
|
|
|
|
|
|
|
type sandbox struct {
|
|
|
|
name string
|
|
|
|
logDir string
|
|
|
|
labels map[string]string
|
|
|
|
}
|