seaweed

package
v0.0.0-...-b7105a7 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2015 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(filename string) error

Delete takes the given filename and deletes it from seaweed

func Get

func Get(filename string, headers, urlParams map[string]string) (io.ReadCloser, *http.Header, error)

Get takes the given filename, gets the file from seaweed, returns an io.Reader you must close this io.Reader. The io.Reader might be nil if no response was returned or there was an error. You can also include headers HTTP headers to send along with the request and url params

func Lookup

func Lookup(filename string, urlParams map[string]string) (string, error)

Lookup takes a filename and returns the seaweed url needed to get that file

func Upload

func Upload(r *AssignResult, body io.Reader, ct string, urlParams map[string]string) error

Upload takes an existing AssignResult call that has already been validated and a io.Reader body. It uploads the body to the sent seaweed volume and fid. Optionally it passes along a ttl to seaweed.

Types

type AssignResult

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

AssignResult holds the result of the assign call to seaweed. It exposes two methods to get the Filename and the URL

func Assign

func Assign(replication, ttl string) (*AssignResult, error)

Assign makes an assign call to seaweed to get a filename that can be uploaded to and returns an AssignResult. Optionally replication can be sent to guarantee the replication of the file and ttl can be sent to expire the file after a specific amount of time. See the seaweedfs docs.

func NewAssignResult

func NewAssignResult(u, filename string) (*AssignResult, error)

NewAssignResult returns a AssignResult from a url and filename. This is used when a signature is decoded

func NewRawAssignResult

func NewRawAssignResult(u, fid string) *AssignResult

NewRawAssignResult returns a AssignResult from a url and fid. This is used when decoding rawAssignResults

func (*AssignResult) FID

func (r *AssignResult) FID() string

Returns the fid of the file which can be used for uploading to seaweed manually

func (*AssignResult) Filename

func (r *AssignResult) Filename() string

Returns the filename useful for uploading. It's base64-encoded to ensure url acceptance and to hide any seaweed formatting

func (*AssignResult) Host

func (r *AssignResult) Host() string

Returns the host:port of the seaweed volume that contains this file. This is only exposed for hiding this value in the signature

func (*AssignResult) URL

func (r *AssignResult) URL() string

Returns the full URL that contains this file.

Jump to

Keyboard shortcuts

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