Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename path name #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions fsshell.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type FsShell struct {
// Appends the specified list of local files to the HDFS path.
func (shell FsShell) AppendToFile(filePaths []string, hdfsPath string) (bool, error) {

for _, path := range filePaths {
file, err := os.Open(path)
for _, filePath := range filePaths {
file, err := os.Open(filePath)

if err != nil {
return false, err
Expand All @@ -42,14 +42,14 @@ func (shell FsShell) AppendToFile(filePaths []string, hdfsPath string) (bool, er

// Returns a writer with the content of the specified files.
func (shell FsShell) Cat(hdfsPaths []string, writr io.Writer) error {
for _, path := range hdfsPaths {
stat, err := shell.FileSystem.GetFileStatus(Path{Name: path})
for _, hdfsPath := range hdfsPaths {
stat, err := shell.FileSystem.GetFileStatus(Path{Name: hdfsPath})
if err != nil {
return err
}
//TODO add code to chunk super large files.
if stat.Length < MAX_DOWN_CHUNK {
readr, err := shell.FileSystem.Open(Path{Name: path}, 0, stat.Length, 4096)
readr, err := shell.FileSystem.Open(Path{Name: hdfsPath}, 0, stat.Length, 4096)
if err != nil {
return err
}
Expand All @@ -61,8 +61,8 @@ func (shell FsShell) Cat(hdfsPaths []string, writr io.Writer) error {

// Changes the group association of the given hdfs paths.
func (shell FsShell) Chgrp(hdfsPaths []string, grpName string) (bool, error) {
for _, path := range hdfsPaths {
_, err := shell.FileSystem.SetOwner(Path{Name: path}, "", grpName)
for _, hdfsPath := range hdfsPaths {
_, err := shell.FileSystem.SetOwner(Path{Name: hdfsPath}, "", grpName)
if err != nil {
return false, err
}
Expand All @@ -72,8 +72,8 @@ func (shell FsShell) Chgrp(hdfsPaths []string, grpName string) (bool, error) {

// Changes the owner of the specified hdfs paths.
func (shell FsShell) Chown(hdfsPaths []string, owner string) (bool, error) {
for _, path := range hdfsPaths {
_, err := shell.FileSystem.SetOwner(Path{Name: path}, owner, "")
for _, hdfsPath := range hdfsPaths {
_, err := shell.FileSystem.SetOwner(Path{Name: hdfsPath}, owner, "")
if err != nil {
return false, err
}
Expand All @@ -83,8 +83,8 @@ func (shell FsShell) Chown(hdfsPaths []string, owner string) (bool, error) {

// Changes the filemode of the provided hdfs paths.
func (shell FsShell) Chmod(hdfsPaths []string, perm os.FileMode) (bool, error) {
for _, path := range hdfsPaths {
_, err := shell.FileSystem.SetPermission(Path{Name: path}, perm)
for _, hdfsPath := range hdfsPaths {
_, err := shell.FileSystem.SetPermission(Path{Name: hdfsPath}, perm)
if err != nil {
return false, err
}
Expand Down