Documentation ¶
Overview ¶
The gomanta/manta package interacts with the Manta API (http://apidocs.joyent.com/manta/api.html).
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (c) 2016 Joyent Inc. Written by Daniele Stroppa <daniele.stroppa@joyent.com>
Index ¶
- Constants
- type Client
- func (c *Client) AddJobInputs(jobId string, jobInputs io.Reader) error
- func (c *Client) CancelJob(jobId string) error
- func (c *Client) CreateJob(opts CreateJobOpts) (string, error)
- func (c *Client) DeleteDirectory(path string) error
- func (c *Client) DeleteObject(path, objectName string) error
- func (c *Client) EndJobInputs(jobId string) error
- func (c *Client) GetJob(jobId string) (Job, error)
- func (c *Client) GetJobErrors(jobId string) ([]JobError, error)
- func (c *Client) GetJobFailures(jobId string) (interface{}, error)
- func (c *Client) GetJobInput(jobId string) (string, error)
- func (c *Client) GetJobOutput(jobId string) (string, error)
- func (c *Client) GetObject(path, objectName string) ([]byte, error)
- func (c *Client) ListDirectory(directory string, opts ListDirectoryOpts) ([]Entry, error)
- func (c *Client) ListJobs(liveOnly bool) ([]Entry, error)
- func (c *Client) PutDirectory(path string) error
- func (c *Client) PutObject(path, objectName string, object []byte) error
- func (c *Client) PutSnapLink(path, linkName, location string) error
- func (c *Client) SignURL(path string, expires time.Time) (string, error)
- type CreateJobOpts
- type Entry
- type Job
- type JobError
- type JobStats
- type ListDirectoryOpts
- type Phase
Constants ¶
const (
// The default version of the Manta API to use
DefaultAPIVersion = "7.1"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a means to access Joyent Manta
func (*Client) AddJobInputs ¶
Submits inputs to an already created job. See API docs: http://apidocs.joyent.com/manta/api.html#AddJobInputs
func (*Client) CancelJob ¶
This cancels a job from doing any further work. Cancellation is asynchronous and "best effort"; there is no guarantee the job will actually stop See API docs: http://apidocs.joyent.com/manta/api.html#CancelJob
func (*Client) CreateJob ¶
func (c *Client) CreateJob(opts CreateJobOpts) (string, error)
Creates a job with the given options. See API docs: http://apidocs.joyent.com/manta/api.html#CreateJob
func (*Client) DeleteDirectory ¶
Deletes the specified directory. Directory must be empty. See API docs: http://apidocs.joyent.com/manta/api.html#DeleteDirectory
func (*Client) DeleteObject ¶
Deletes the specified object from the specified location. See API docs: http://apidocs.joyent.com/manta/api.html#DeleteObject
func (*Client) EndJobInputs ¶
This closes input for a job, and finalize the job. See API docs: http://apidocs.joyent.com/manta/api.html#EndJobInput
func (*Client) GetJob ¶
Gets the high-level job container object for a given job. See API docs: http://apidocs.joyent.com/manta/api.html#GetJob
func (*Client) GetJobErrors ¶
Returns the current "live" set of errors from a given job. See API docs: http://apidocs.joyent.com/manta/api.html#GetJobErrors
func (*Client) GetJobFailures ¶
Returns the current "live" set of failures from a given job. See API docs: http://apidocs.joyent.com/manta/api.html#GetJobFailures
func (*Client) GetJobInput ¶
Returns the submitted input objects for a given job, available while the job is running. See API docs: http://apidocs.joyent.com/manta/api.html#GetJobInput
func (*Client) GetJobOutput ¶
Returns the current "live" set of outputs from a given job. See API docs: http://apidocs.joyent.com/manta/api.html#GetJobOutput
func (*Client) GetObject ¶
Retrieves the specified object from the specified location. See API docs: http://apidocs.joyent.com/manta/api.html#GetObject
func (*Client) ListDirectory ¶
func (c *Client) ListDirectory(directory string, opts ListDirectoryOpts) ([]Entry, error)
Returns the content of the specified directory, using the specified options. See API docs: http://apidocs.joyent.com/manta/api.html#ListDirectory
func (*Client) ListJobs ¶
Returns the list of jobs. Note you can filter the set of jobs down to only live jobs by setting the liveOnly flag. See API docs: http://apidocs.joyent.com/manta/api.html#ListJobs
func (*Client) PutDirectory ¶
Creates a directory at the specified path. Any parent directory must exist. See API docs: http://apidocs.joyent.com/manta/api.html#PutDirectory
func (*Client) PutObject ¶
Creates an object at the specified path. Any parent directory must exist. See API docs: http://apidocs.joyent.com/manta/api.html#PutObject
func (*Client) PutSnapLink ¶
Creates a link (similar to a Unix hard link) from location to path/linkName. See API docs: http://apidocs.joyent.com/manta/api.html#PutSnapLink
type CreateJobOpts ¶
type CreateJobOpts struct { Name string `json:"name,omitempty"` // Job Name (optional) Phases []Phase `json:"phases"` // Tasks to execute as part of this job }
CreateJobOpts represent the option that can be specified when creating a job.
type Entry ¶
type Entry struct { Name string `json:"name"` // Entry name Etag string `json:"etag,omitempty"` // If type is 'object', object UUID Size int `json:"size,omitempty"` // If type is 'object', object size (content-length) Type string `json:"type"` // Entry type, one of 'directory' or 'object' Mtime string `json:"mtime"` // ISO8601 timestamp of the last update }
Entry represents an object stored in Manta, either a file or a directory
type Job ¶
type Job struct { Id string // Job unique identifier Name string `json:"name,omitempty"` // Job Name State string // Job state Cancelled bool // Whether the job has been cancelled or not InputDone bool // Whether the inputs for the job is still open or not Stats JobStats `json:"stats,omitempty"` // Job statistics TimeCreated string // Time the job was created at TimeDone string `json:"timeDone,omitempty"` // Time the job was completed TimeArchiveStarted string `json:"timeArchiveStarted,omitempty"` // Time the job archiving started TimeArchiveDone string `json:"timeArchiveDone,omitempty"` // Time the job archiving completed Phases []Phase `json:"phases"` // Job tasks Options interface{} // Job options }
Job represents the status of a job.
type JobError ¶
type JobError struct { Id string // Job Id Phase string // Phase number of the failure What string // A human readable summary of what failed Code string // Error code Message string // Human readable error message Stderr string // A key that saved the stderr for the given command (optional) Key string // The input key being processed when the task failed (optional) }
JobError represents an error occurred during a job execution
type JobStats ¶
type JobStats struct { Errors int // Number or errors Outputs int // Number of output produced Retries int // Number of retries Tasks int // Total number of task in the job TasksDone int // number of tasks done }
JobStats represents statistics about a job
type ListDirectoryOpts ¶
type ListDirectoryOpts struct { Limit int `json:"limit"` // Limit to the number of records returned (default and max is 1000) Marker string `json:"marker"` // Key name at which to start the next listing }
ListDirectoryOpts represent the option that can be specified when listing a directory.
type Phase ¶
type Phase struct { Type string `json:"type,omitempty"` // Task type, one of 'map' or 'reduce' (optional) Assets []string `json:"assets,omitempty"` // An array of objects to be placed in the compute zones (optional) Exec string `json:"exec"` // The actual shell statement to execute Init string `json:"init"` // Shell statement to execute in each compute zone before any tasks are executed Count int `json:"count,omitempty"` // If type is 'reduce', an optional number of reducers for this phase (default is 1) Memory int `json:"memory,omitempty"` // Amount of DRAM to give to your compute zone (in Mb, optional) Disk int `json:"disk,omitempty"` // Amount of disk space to give to your compute zone (in Gb, optional) }
Phase represents a task to be executed as part of a Job