weed

package
v0.0.0-...-2b644c5 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const PairNamePrefix = "Seaweed-"

Variables

View Source
var ErrCidNotFound = errors.New("cid not found")

Functions

func Param

func Param(r *http.Request, key string) string

Types

type AssignResult

type AssignResult struct {
	FileID    string `json:"fid,omitempty"`
	URL       string `json:"url,omitempty"`
	PublicURL string `json:"publicUrl,omitempty"`
	Count     int    `json:"count,omitempty"`
	Error     string `json:"error,omitempty"`
}

AssignResult contains assign result. Raw response: {"fid":"1,0a1653fd0f","url":"localhost:8899","publicUrl":"localhost:8899","count":1,"error":""}

type Cid

type Cid struct {
	Cid      string `json:"cid"`
	Fid      string `json:"fid"`
	FileName string `json:"fileName"`
	DataSize int    `json:"dataSize"`
}

type Client

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

func (*Client) Close

func (c *Client) Close() error

func (*Client) Delete

func (c *Client) Delete(cid string) (*Response, error)

func (*Client) GetVolumePublicUrls

func (c *Client) GetVolumePublicUrls(vid string) (urls []string, err error)

func (*Client) Process

func (c *Client) Process(w http.ResponseWriter, r *http.Request)

func (*Client) Upload

func (c *Client) Upload(cid string, pu *File) (*Response, error)

func (*Client) UploadJSON

func (c *Client) UploadJSON(cid string, bean interface{}) (*Response, error)

type Config

type Config struct {
	Masters      []string
	FidStorePath string
}

func (*Config) New

func (c *Config) New(ctx context.Context) (*Client, error)

type File

type File struct {
	Name      string
	Data      []byte
	DataSize  int
	MimeType  string
	Pairs     map[string]string
	IsGzipped bool
}

func ParseUpload

func ParseUpload(r *http.Request, sizeLimit int64) (pu *File, e error)

type Response

type Response struct {
	Status  int         `json:"status"`
	Message string      `json:"message,omitempty"`
	Data    interface{} `json:"data,omitempty"`
}

type UploadResult

type UploadResult struct {
	Cid string `json:"cid,omitempty"`
	Fid string `json:"fid,omitempty"`
}

type VolumeCache

type VolumeCache struct {
	Updated    time.Time
	PublicUrls []string
}

type VolumeStatus

type VolumeStatus struct {
	VolumeID  string `json:"volumeId"`
	Error     string `json:"error"`
	Locations []struct {
		URL       string `json:"url"`
		PublicURL string `json:"publicUrl"`
	} `json:"locations"`
}

Jump to

Keyboard shortcuts

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