client

package
v1.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MANTA_URL, MANTA_USER, MANTA_KEY_ID, SDC_IDENTITY string

Functions

func Initialize

func Initialize(url string, user string, keyID string, identityPath string)

manta_url := os.Getenv("MANTA_URL")

Types

type Client

type Client struct {
	User        string
	KeyId       string
	Key         string
	Url         string
	HTTPTimeout time.Duration
	// contains filtered or unexported fields
}

Client is a Manta client. Client is not safe for concurrent use.

func DefaultClient

func DefaultClient() *Client

DefaultClient returns a Client instance configured from the default Manta environment variables.

func (*Client) AddJobInput

func (c *Client) AddJobInput(jobID string, input io.Reader) error

AddJobInput submits input to a job previously created by CreateJob

func (*Client) CreateJob

func (c *Client) CreateJob(opts CreateJobOpts) (string, error)

CreateJob submits a job to Manta and returns the URI for the job.

func (*Client) Delete

func (c *Client) Delete(path string) (*http.Response, error)

Delete executes a DELETE request and returns the response.

func (*Client) DeleteDirectory

func (c *Client) DeleteDirectory(path string) error

DeleteDirectory deletes a directory. The directory must be empty. There is no response data from this request. On success an HTTP 204 is returned

func (*Client) Do

func (c *Client) Do(method, path string, headers http.Header, r io.Reader) (*http.Response, error)

Do executes a method request and returns the response.

func (*Client) EndJobInput

func (c *Client) EndJobInput(jobID string) error

EndJobInput closes input for a job previously created by CreateJob

func (*Client) Get

func (c *Client) Get(path string, headers http.Header) (*http.Response, error)

Get executes a GET request and returns the response.

func (*Client) GetJob

func (c *Client) GetJob(jobID string) (Job, error)

func (*Client) GetJobOutput

func (c *Client) GetJobOutput(jobID string) (string, error)

func (*Client) GetObject

func (c *Client) GetObject(path string) (io.Reader, error)

GetObject retrieves an object https://apidocs.joyent.com/manta/api.html#GetObject

func (*Client) ListDirectory

func (c *Client) ListDirectory(path string) ([]Entry, error)

ListDirectory lists the contents of a directory https://apidocs.joyent.com/manta/api.html#ListDirectory

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, r io.Reader) (*http.Request, error)

NewRequest is similar to http.NewRequest except it appends path to the API endpoint this client is configured for.

func (*Client) Post

func (c *Client) Post(path string, headers http.Header, body io.Reader) (*http.Response, error)

Post executes a POST request and returns the response.

func (*Client) Put

func (c *Client) Put(path string, headers http.Header, r io.Reader) (*http.Response, error)

Put executes a PUT request and returns the response.

func (*Client) PutDirectory

func (c *Client) PutDirectory(path string) error

PutDirectory in the Joyent Manta Storage Service is an idempotent create-or-update operation https://apidocs.joyent.com/manta/api.html#PutDirectory

func (*Client) PutObject

func (c *Client) PutObject(destination string, contentType string, r io.Reader) error

PutObject creates or overwrites an object https://apidocs.joyent.com/manta/api.html#PutObject

func (*Client) SignRequest

func (c *Client) SignRequest(req *http.Request) error

SignRequest signs the 'date' field of req.

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
	Durability int    `json:"durability"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL