Skip to content

Commit

Permalink
Renamed AllocFile to AllocFileInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
diptanu committed Jan 14, 2016
1 parent 78d0361 commit 4345fc9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions client/alloc_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
16 changes: 8 additions & 8 deletions client/allocdir/alloc_dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type AllocDir struct {
mounted []string
}

type AllocFile struct {
type AllocFileInfo struct {
Name string
IsDir bool
Size int64
Expand Down Expand Up @@ -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(),
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit 4345fc9

Please sign in to comment.