Documentation ¶
Index ¶
- Constants
- func DeleteFile(fid string) (err error)
- func FetchFile(fid string) (resp *http.Response, err error)
- func GetDownloadUrl(fid string) (*url.URL, error)
- func InitHttpClient(c *http.Client)
- func IsSuccessStatus(statuscode int) bool
- func MasterUrl() (u *url.URL, err error)
- func UploadSingleFile(f io.Reader, name string, fid string, volumeUrl string, isManifest bool) (resp *http.Response, err error)
- type ChunkInfo
- type ChunkList
- type ChunkManifest
- type Fid
- type FileKeyInfo
- type FileUploadMeta
- func (f *FileUploadMeta) CheckChunkOffset(offset int64, size int64) (uploaded bool, err error)
- func (f *FileUploadMeta) CheckFileHash() error
- func (f *FileUploadMeta) GetChunkHashFromCache(chunk *ChunkInfo) (string, error)
- func (f *FileUploadMeta) Marshal() ([]byte, error)
- func (f *FileUploadMeta) SetStatus(s int)
- func (f *FileUploadMeta) StoreChunkHash(chunk *ChunkInfo, hash string) error
- func (f *FileUploadMeta) Unmarshal(b []byte) error
- func (f *FileUploadMeta) Upload(raw []byte, offset int64, hash string) error
- func (f *FileUploadMeta) UploadManifest() error
- func (f *FileUploadMeta) UploadedChunks() []int64
- type VolumeLookupInfo
Constants ¶
View Source
const ( Inited = iota Uploading Manifest WeedDone DBDone )
View Source
const ( FilePath = "/dir/assign" LookupVolumePath = "/dir/lookup" VolumeCacheKey = "weed:volumeid=%s" )
View Source
const ChunkHashKey = "chunk:token=%s;offset=%d"
Variables ¶
This section is empty.
Functions ¶
func DeleteFile ¶
func InitHttpClient ¶
func IsSuccessStatus ¶
Types ¶
type ChunkManifest ¶
type ChunkManifest struct { Name string `json:"name,omitempty"` Mime string `json:"mime,omitempty"` Size int64 `json:"size,omitempty"` Chunks ChunkList `json:"chunks,omitempty"` }
func (*ChunkManifest) Json ¶
func (m *ChunkManifest) Json() ([]byte, error)
generate manifest reader
type FileKeyInfo ¶
type FileKeyInfo struct { Count int `json:"count"` Fid string `json:"fid"` Url string `json:"url"` PublicUrl string `json:"publicUrl"` }
func AssignFileKey ¶
func AssignFileKey() (*FileKeyInfo, error)
type FileUploadMeta ¶
type FileUploadMeta struct { Token string OwnerId int64 FolderId int64 Status int // shouldn't modify directly Hash string Mime string Fid string // chunk info ChunkManifest ChunkSize int64 }
func NewUploadMeta ¶
func (*FileUploadMeta) CheckChunkOffset ¶
func (f *FileUploadMeta) CheckChunkOffset(offset int64, size int64) (uploaded bool, err error)
func (*FileUploadMeta) CheckFileHash ¶
func (f *FileUploadMeta) CheckFileHash() error
func (*FileUploadMeta) GetChunkHashFromCache ¶
func (f *FileUploadMeta) GetChunkHashFromCache(chunk *ChunkInfo) (string, error)
func (*FileUploadMeta) Marshal ¶
func (f *FileUploadMeta) Marshal() ([]byte, error)
func (*FileUploadMeta) SetStatus ¶
func (f *FileUploadMeta) SetStatus(s int)
func (*FileUploadMeta) StoreChunkHash ¶
func (f *FileUploadMeta) StoreChunkHash(chunk *ChunkInfo, hash string) error
func (*FileUploadMeta) Unmarshal ¶
func (f *FileUploadMeta) Unmarshal(b []byte) error
func (*FileUploadMeta) Upload ¶
func (f *FileUploadMeta) Upload(raw []byte, offset int64, hash string) error
always upload in chunk, just make it simple
func (*FileUploadMeta) UploadManifest ¶
func (f *FileUploadMeta) UploadManifest() error
func (*FileUploadMeta) UploadedChunks ¶
func (f *FileUploadMeta) UploadedChunks() []int64
type VolumeLookupInfo ¶
type VolumeLookupInfo struct { VolumeId string `json:"volumeId"` Locations []struct { PublicUrl string `json:"publicUrl"` Url string `json:"url"` } `json:"locations"` }
func LookupVolume ¶
func LookupVolume(volumeId string) (*VolumeLookupInfo, error)
func LookupVolumeNoCache ¶
func LookupVolumeNoCache(volumeId string) (*VolumeLookupInfo, error)
func (*VolumeLookupInfo) Marshal ¶
func (v *VolumeLookupInfo) Marshal() ([]byte, error)
func (*VolumeLookupInfo) Unmarshal ¶
func (v *VolumeLookupInfo) Unmarshal(b []byte) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.