alluxio-go: github.com/Alluxio/alluxio-go Index | Examples | Files | Directories

package alluxio

import "github.com/Alluxio/alluxio-go"

Package alluxio provides the Alluxio file system client.

Index

Examples

Package Files

client.go doc.go paths.go streams.go

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

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)
}

Code:

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

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)
}

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 Uses

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

NewClient is the Alluxio file system client factory.

func (*Client) Close Uses

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

Close closes a stream.

func (*Client) CreateDirectory Uses

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

CreateDirectory creates a directory.

func (*Client) CreateFile Uses

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

CreateFile creates a file, returning a stream id.

func (*Client) Delete Uses

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

Delete deletes a path.

func (*Client) Exists Uses

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

Exists checks whether a path exists.

func (*Client) Free Uses

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

Free frees a path.

func (*Client) GetStatus Uses

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

GetStatus gets a path status.

func (*Client) ListStatus Uses

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

ListStatus lists path statuses.

func (*Client) Mount Uses

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

Mount mounts a UFS source to a path.

func (*Client) OpenFile Uses

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

OpenFile opens a file, returning a stream id.

func (*Client) Read Uses

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

Read reads from a stream.

func (*Client) Rename Uses

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

Rename renames a path.

func (*Client) SetAttribute Uses

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

SetAttribute sets path attributes.

func (*Client) Unmount Uses

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

Unmount unmounts a path.

func (*Client) Write Uses

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

Write writes to a stream.

Directories

PathSynopsis
optionPackage option contains types for method options.
optiontestPackage optiontest contains utilities for testing method options.
wirePackage wire contains Alluxio file system wire types.
wiretestPackage wiretest contains utilites for testing Alluxio file system wire types.

Package alluxio imports 11 packages (graph). Updated 2017-12-06. Refresh now. Tools for package owners.