From 4345fc9bee59297a5ebd06ddb5e259e8e873d604 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Wed, 13 Jan 2016 17:18:10 -0800 Subject: [PATCH] Renamed AllocFile to AllocFileInfo --- client/alloc_runner.go | 10 +++++----- client/allocdir/alloc_dir.go | 16 ++++++++-------- client/client.go | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/client/alloc_runner.go b/client/alloc_runner.go index 5e8b44287520..65a73b15f9ea 100644 --- a/client/alloc_runner.go +++ b/client/alloc_runner.go @@ -426,14 +426,14 @@ func (r *AllocRunner) WaitCh() <-chan struct{} { return r.waitCh } -func (r *AllocRunner) FSList(path string) ([]*allocdir.AllocFile, error) { - return r.ctx.AllocDir.FSList(path) +func (r *AllocRunner) FSList(path string) ([]*allocdir.AllocFileInfo, error) { + return r.ctx.AllocDir.List(path) } -func (r *AllocRunner) FSStat(path string) (*allocdir.AllocFile, error) { - return r.ctx.AllocDir.FSStat(path) +func (r *AllocRunner) FSStat(path string) (*allocdir.AllocFileInfo, error) { + return r.ctx.AllocDir.Stat(path) } func (r *AllocRunner) FSReadAt(allocID string, path string, offset int64, limit int64, w io.Writer) error { - return r.ctx.AllocDir.FSReadAt(allocID, path, offset, limit, w) + return r.ctx.AllocDir.ReadAt(allocID, path, offset, limit, w) } diff --git a/client/allocdir/alloc_dir.go b/client/allocdir/alloc_dir.go index 3ee33c72ef29..c227282d7f63 100644 --- a/client/allocdir/alloc_dir.go +++ b/client/allocdir/alloc_dir.go @@ -38,7 +38,7 @@ type AllocDir struct { mounted []string } -type AllocFile struct { +type AllocFileInfo struct { Name string IsDir bool Size int64 @@ -223,15 +223,15 @@ func (d *AllocDir) MountSharedDir(task string) error { return nil } -func (d *AllocDir) FSList(path string) ([]*AllocFile, error) { +func (d *AllocDir) List(path string) ([]*AllocFileInfo, error) { p := filepath.Join(d.AllocDir, path) finfos, err := ioutil.ReadDir(p) if err != nil { - return []*AllocFile{}, nil + return []*AllocFileInfo{}, nil } - files := make([]*AllocFile, len(finfos)) + files := make([]*AllocFileInfo, len(finfos)) for idx, info := range finfos { - files[idx] = &AllocFile{ + files[idx] = &AllocFileInfo{ Name: info.Name(), IsDir: info.IsDir(), Size: info.Size(), @@ -240,21 +240,21 @@ func (d *AllocDir) FSList(path string) ([]*AllocFile, error) { return files, err } -func (d *AllocDir) FSStat(path string) (*AllocFile, error) { +func (d *AllocDir) Stat(path string) (*AllocFileInfo, error) { p := filepath.Join(d.AllocDir, path) info, err := os.Stat(p) if err != nil { return nil, err } - return &AllocFile{ + return &AllocFileInfo{ Size: info.Size(), Name: info.Name(), IsDir: info.IsDir(), }, nil } -func (d *AllocDir) FSReadAt(allocID string, path string, offset int64, limit int64, w io.Writer) error { +func (d *AllocDir) ReadAt(allocID string, path string, offset int64, limit int64, w io.Writer) error { p := filepath.Join(d.AllocDir, path) f, err := os.Open(p) if err != nil { diff --git a/client/client.go b/client/client.go index 8fe213572ad8..737ab9b38059 100644 --- a/client/client.go +++ b/client/client.go @@ -355,7 +355,7 @@ func (c *Client) Node() *structs.Node { return c.config.Node } -func (c *Client) FSList(allocID string, path string) ([]*allocdir.AllocFile, error) { +func (c *Client) FSList(allocID string, path string) ([]*allocdir.AllocFileInfo, error) { ar, ok := c.allocs[allocID] if !ok { return nil, fmt.Errorf("alloc not present") @@ -364,7 +364,7 @@ func (c *Client) FSList(allocID string, path string) ([]*allocdir.AllocFile, err return ar.FSList(path) } -func (c *Client) FSStat(allocID string, path string) (*allocdir.AllocFile, error) { +func (c *Client) FSStat(allocID string, path string) (*allocdir.AllocFileInfo, error) { ar, ok := c.allocs[allocID] if !ok { return nil, fmt.Errorf("alloc not found")