Back to godoc.org
github.com/Alluxio/alluxio-go

Package alluxio

v0.0.0-...-d8c9fa5
Latest Go to latest

The latest major version is .

Published: Dec 6, 2017 | Licenses: Apache-2.0 , BSD-2-Clause , EPL-1.0 , MIT | Module: github.com/Alluxio/alluxio-go

Overview

Package alluxio provides the Alluxio file system client.

Index

Examples

type Client

type Client struct {
	// contains filtered or unexported fields
}
Example (Download)

Code:

fs := NewClient("localhost", 39999, time.Minute)
id, err := fs.OpenFile("/test_file", &option.OpenFile{})
if err != nil {
	log.Fatal(err)
}
r, err := fs.Read(id)
if err != nil {
	log.Fatal(err)
}
defer r.Close()
defer fs.Close(id)
if _, err := io.Copy(ioutil.Discard, r); err != nil {
	log.Fatal(err)
}
Example (Exists)

Code:

fs := NewClient("localhost", 39999, time.Minute)
ok, err := fs.Exists("/test_path", &option.Exists{})
if err != nil {
	log.Fatal(err)
}
fmt.Println(ok)
Example (ListStatus)

Code:

fs := NewClient("localhost", 39999, time.Minute)
fileInfos, err := fs.ListStatus("/test_path", &option.ListStatus{})
if err != nil {
	log.Fatal(err)
}
for _, fileInfo := range fileInfos {
	fmt.Println(fileInfo.Name)
}
Example (Upload)

Code:

fs := NewClient("localhost", 39999, time.Minute)
id, err := fs.CreateFile("/test_file", &option.CreateFile{})
if err != nil {
	log.Fatal(err)
}
n, err := fs.Write(id, bytes.NewBuffer(make([]byte, 1024)))
if err != nil {
	log.Fatal(err)
}
defer fs.Close(id)
fmt.Println(n)

func NewClient

func NewClient(host string, port int, timeout time.Duration) *Client

NewClient is the Alluxio file system client factory.

func (*Client) Close

func (client *Client) Close(id int) error

Close closes a stream.

func (*Client) CreateDirectory

func (client *Client) CreateDirectory(path string, options *option.CreateDirectory) error

CreateDirectory creates a directory.

func (*Client) CreateFile

func (client *Client) CreateFile(path string, options *option.CreateFile) (int, error)

CreateFile creates a file, returning a stream id.

func (*Client) Delete

func (client *Client) Delete(path string, options *option.Delete) error

Delete deletes a path.

func (*Client) Exists

func (client *Client) Exists(path string, options *option.Exists) (bool, error)

Exists checks whether a path exists.

func (*Client) Free

func (client *Client) Free(path string, options *option.Free) error

Free frees a path.

func (*Client) GetStatus

func (client *Client) GetStatus(path string, options *option.GetStatus) (*wire.FileInfo, error)

GetStatus gets a path status.

func (*Client) ListStatus

func (client *Client) ListStatus(path string, options *option.ListStatus) (wire.FileInfos, error)

ListStatus lists path statuses.

func (*Client) Mount

func (client *Client) Mount(path, src string, options *option.Mount) error

Mount mounts a UFS source to a path.

func (*Client) OpenFile

func (client *Client) OpenFile(path string, options *option.OpenFile) (int, error)

OpenFile opens a file, returning a stream id.

func (*Client) Read

func (client *Client) Read(id int) (io.ReadCloser, error)

Read reads from a stream.

func (*Client) Rename

func (client *Client) Rename(path, dst string, options *option.Rename) error

Rename renames a path.

func (*Client) SetAttribute

func (client *Client) SetAttribute(path string, options *option.SetAttribute) error

SetAttribute sets path attributes.

func (*Client) Unmount

func (client *Client) Unmount(path string, options *option.Unmount) error

Unmount unmounts a path.

func (*Client) Write

func (client *Client) Write(id int, input io.Reader) (int, error)

Write writes to a stream.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier