Documentation
¶
Index ¶
- func Delete(filename string) error
- func Get(filename string, headers, urlParams map[string]string) (io.ReadCloser, *http.Header, error)
- func Lookup(filename string, urlParams map[string]string) (string, error)
- func Upload(r *AssignResult, body io.Reader, ct string, urlParams map[string]string) error
- type AssignResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
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.