snapshot: fix terminology inconsistency

LayerManipulator, SnapshotManipulator -> SnapshotManager

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2017-01-17 08:42:27 +00:00
parent 7c975e37a9
commit 1f763301a6
9 changed files with 102 additions and 98 deletions

View file

@ -12,7 +12,7 @@ import (
"github.com/docker/containerd"
)
func NewOverlayfs(root string) (*Overlayfs, error) {
func NewOverlay(root string) (*Overlay, error) {
if err := os.MkdirAll(root, 0700); err != nil {
return nil, err
}
@ -24,18 +24,18 @@ func NewOverlayfs(root string) (*Overlayfs, error) {
return nil, err
}
}
return &Overlayfs{
return &Overlay{
root: root,
cache: newCache(),
}, nil
}
type Overlayfs struct {
type Overlay struct {
root string
cache *cache
}
func (o *Overlayfs) Prepare(key string, parentName string) ([]containerd.Mount, error) {
func (o *Overlay) Prepare(key string, parentName string) ([]containerd.Mount, error) {
if err := validKey(key); err != nil {
return nil, err
}
@ -51,12 +51,12 @@ func (o *Overlayfs) Prepare(key string, parentName string) ([]containerd.Mount,
return active.mounts(o.cache)
}
func (o *Overlayfs) Commit(name, key string) error {
func (o *Overlay) Commit(name, key string) error {
active := o.getActive(key)
return active.commit(name)
}
func (o *Overlayfs) newActiveDir(key string) (*activeDir, error) {
func (o *Overlay) newActiveDir(key string) (*activeDir, error) {
var (
hash = hash(key)
path = filepath.Join(o.root, "active", hash)
@ -77,7 +77,7 @@ func (o *Overlayfs) newActiveDir(key string) (*activeDir, error) {
return a, nil
}
func (o *Overlayfs) getActive(key string) *activeDir {
func (o *Overlay) getActive(key string) *activeDir {
return &activeDir{
path: filepath.Join(o.root, "active", hash(key)),
snapshotsDir: filepath.Join(o.root, "snapshots"),

View file

@ -10,13 +10,13 @@ import (
"github.com/docker/containerd"
)
func TestOverlayfs(t *testing.T) {
func TestOverlay(t *testing.T) {
root, err := ioutil.TempDir("", "overlay")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(root)
o, err := NewOverlayfs(root)
o, err := NewOverlay(root)
if err != nil {
t.Error(err)
return
@ -45,13 +45,13 @@ func TestOverlayfs(t *testing.T) {
}
}
func TestOverlayfsCommit(t *testing.T) {
func TestOverlayCommit(t *testing.T) {
root, err := ioutil.TempDir("", "overlay")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(root)
o, err := NewOverlayfs(root)
o, err := NewOverlay(root)
if err != nil {
t.Error(err)
return
@ -73,13 +73,13 @@ func TestOverlayfsCommit(t *testing.T) {
}
}
func TestOverlayfsOverlayMount(t *testing.T) {
func TestOverlayOverlayMount(t *testing.T) {
root, err := ioutil.TempDir("", "overlay")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(root)
o, err := NewOverlayfs(root)
o, err := NewOverlay(root)
if err != nil {
t.Error(err)
return
@ -125,7 +125,7 @@ func TestOverlayfsOverlayMount(t *testing.T) {
}
}
func TestOverlayfsOverlayRead(t *testing.T) {
func TestOverlayOverlayRead(t *testing.T) {
if os.Getuid() != 0 {
t.Skip("not running as root")
}
@ -134,7 +134,7 @@ func TestOverlayfsOverlayRead(t *testing.T) {
t.Fatal(err)
}
defer os.RemoveAll(root)
o, err := NewOverlayfs(root)
o, err := NewOverlay(root)
if err != nil {
t.Error(err)
return