mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 18:05:42 +03:00
Renamed AllocFile to AllocFileInfo
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user