func (fs *Client) Mkdir(fpath string) error { var cErr rpc.StrError err := fs.rpc.Call("RemoteFS.Mkdir", fpath, &cErr) if err != nil { return fmt.Errorf("rpc error: %v", err) } if !cErr.IsNil() { return cErr } return nil }
func (fs *Client) Create(fpath string) (io.WriteCloser, error) { var cErr rpc.StrError f, err := fs.rpc.CallWrite("RemoteFS.Create", fpath, &cErr) if err != nil { return nil, fmt.Errorf("rpc error: %v", err) } if !cErr.IsNil() { return nil, cErr } return f, nil }
func (fs *Client) Open(fpath string) (io.ReadCloser, error) { var cErr rpc.StrError f, err := fs.rpc.CallRead("RemoteFS.Open", fpath, &cErr) if err != nil { return nil, fmt.Errorf("rpc error: %v", err) } if !cErr.IsNil() { return nil, cErr } return closeWrapper{f}, nil }
func (fs *Client) Stat(fpath string) (os.FileInfo, error) { var ( cErr rpc.StrError info util.FileInfo ) err := fs.rpc.Call("RemoteFS.Stat", fpath, &info, &cErr) if err != nil { return nil, fmt.Errorf("rpc error: %v", err) } if !cErr.IsNil() { return nil, cErr } return info, nil }
func (fs *Client) GetFiles(fpath string) ([]os.FileInfo, error) { var ( cErr rpc.StrError infos []util.FileInfo ) err := fs.rpc.Call("RemoteFS.GetFiles", fpath, &infos, &cErr) if err != nil { return nil, fmt.Errorf("rpc error: %v", err) } if !cErr.IsNil() { return nil, cErr } ret := make([]os.FileInfo, len(infos)) for i, info := range infos { ret[i] = info } return ret, nil }