Documentation
¶
Index ¶
- Constants
- Variables
- func CheckFileExisting(ctx context.Context, ...) bool
- func CheckFilePathEx(fileHash, fileName, savePath string) bool
- func CheckSliceExisting(fileHash, fileName, sliceHash, savePath, fileReqId string) bool
- func CleanFileHash(key string)
- func ClearFileMap(hash string)
- func CloseDownloadSession(key string)
- func DeleteDirectory(fileHash string)
- func DeleteSlice(sliceHash string) error
- func DeleteTmpFileSlices(ctx context.Context, fileHash string)
- func DeleteTmpHlsFolder(ctx context.Context, fileHash string)
- func EscapePath(param []string) string
- func GetAllFiles(pathname string)
- func GetDownloadCsvPath(fileHash, fileName, savePath string) string
- func GetDownloadPath(fileName string) string
- func GetDownloadTmpPath(fileHash, fileName, savePath string) string
- func GetDumpySliceData(fileHash string, sliceNumber uint64) []byte
- func GetFileData(filePath string, offset *protos.SliceOffset) []byte
- func GetFileHash(filePath, encryptionTag string) string
- func GetFileInfo(filePath string) os.FileInfo
- func GetFileListResult(key string) (*rpc.FileListResult, bool)
- func GetFilePath(hash string) string
- func GetFileShareResult(key string) (*rpc.FileShareResult, bool)
- func GetFileSuffix(fileName string) string
- func GetQueryOzoneResult(key string) (*rpc.GetOzoneResult, bool)
- func GetRemoteFileData(hash string, offset *protos.SliceOffset) []byte
- func GetRemoteFileInfo(key, reqId string) uint64
- func GetRemoteFileSize(hash string) uint64
- func GetSignatureFromRemote(key string) []byte
- func GetSliceData(sliceHash string) []byte
- func GetSliceDataFromTmp(fileHash, sliceHash string) []byte
- func GetSliceSize(sliceHash string) int64
- func GetVideoDuration(path string) (uint64, error)
- func GetVideoTmpFolder(fileHash string) string
- func GetWholeFileData(filePath string) []byte
- func IsFile(f string) (bool, error)
- func IsFileRpcRemote(key string) bool
- func PathExists(path string) (bool, error)
- func RecordDownloadCSV(target *protos.RspFileStorageInfo)
- func SaveDownloadProgress(ctx context.Context, sliceHash, fileName, fileHash, savePath, fileReqId string)
- func SaveFileData(ctx context.Context, data []byte, offset int64, ...) bool
- func SaveRemoteFileData(key string, data []byte, offset uint64) bool
- func SaveRemoteFileHash(hash, fileName string, fileSize uint64)
- func SaveSliceData(data []byte, sliceHash string, offset uint64) bool
- func SaveTmpSliceData(fileHash, sliceHash string, data []byte) error
- func SendFileDataBack(hash string, content []byte)
- func SetDownloadSliceDone(key string)
- func SetFileListResult(key string, result *rpc.FileListResult)
- func SetFileShareResult(key string, result *rpc.FileShareResult)
- func SetQueryOzoneResult(key string, result *rpc.GetOzoneResult)
- func SetRemoteFileInfo(key string, size uint64)
- func SetRemoteFileResult(key string, result rpc.Result)
- func SetSignature(key string, sig []byte)
- func SubscribeDownloadFileInfo(key string) chan uint64
- func SubscribeDownloadSliceDone(key string) chan bool
- func SubscribeGetRemoteFileData(key string) chan []byte
- func SubscribeGetSignature(key string) chan []byte
- func SubscribeRemoteFileEvent(key string) chan *rpc.Result
- func UnsubscribeDownloadFileInfo(key string)
- func UnsubscribeDownloadSliceDone(key string)
- func UnsubscribeGetRemoteFileData(key string)
- func UnsubscribeGetSignature(key string)
- func UnsubscribeRemoteFileEvent(key string)
- func VideoToHls(ctx context.Context, fileHash string) bool
- func WaitDownloadSliceDone(key string) bool
- type HlsInfo
Constants ¶
const HLS_HEADER_FILENAME = "index.m3u8"
const HLS_SEGMENT_FILENAME = "%d.ts"
const TEMP_FOLDER = "tmp"
Variables ¶
var HlsInfoMap = make(map[string]*HlsInfo)
var ( // wait for the next request from client per message RpcWaitTimeout time.Duration )
Functions ¶
func CheckFileExisting ¶
func CheckFileExisting(ctx context.Context, fileHash, fileName, savePath, encryptionTag, fileReqId string) bool
CheckFileExisting
func CheckFilePathEx ¶
CheckFilePathEx
func CheckSliceExisting ¶
CheckSliceExisting
func CloseDownloadSession ¶ added in v0.9.0
func CloseDownloadSession(key string)
CloseDownloadSession
func DeleteTmpFileSlices ¶ added in v0.8.0
func DeleteTmpHlsFolder ¶ added in v0.8.0
func GetAllFiles ¶
func GetAllFiles(pathname string)
GetAllFiles get all files in directory and all sub-directory recursively
func GetDownloadCsvPath ¶
GetDownloadCsvPath get download CSV path
func GetDownloadPath ¶
GetDownloadPath get download path
func GetDownloadTmpPath ¶
GetDownloadTmpPath get temporary download path
func GetDumpySliceData ¶
func GetFileListResult ¶ added in v0.9.0
func GetFileListResult(key string) (*rpc.FileListResult, bool)
GetFileListResult
func GetFileShareResult ¶ added in v0.9.0
func GetFileShareResult(key string) (*rpc.FileShareResult, bool)
GetFileShareResult
func GetQueryOzoneResult ¶ added in v0.9.0
func GetQueryOzoneResult(key string) (*rpc.GetOzoneResult, bool)
GetQueryOzoneResult
func GetRemoteFileData ¶ added in v0.9.0
func GetRemoteFileData(hash string, offset *protos.SliceOffset) []byte
GetRemoteFileData application calls this func to fetch a (sub)slice of file data from remote user
func GetRemoteFileInfo ¶ added in v0.9.0
GetRemoteFileInfo
func GetRemoteFileSize ¶ added in v0.9.0
GetRemoteFileSize
func GetSignatureFromRemote ¶ added in v0.9.0
GetSignatureFromRemote
func GetSliceDataFromTmp ¶ added in v0.8.0
func GetVideoDuration ¶
func GetVideoTmpFolder ¶
func GetWholeFileData ¶
func RecordDownloadCSV ¶
func RecordDownloadCSV(target *protos.RspFileStorageInfo)
RecordDownloadCSV
func SaveDownloadProgress ¶
func SaveDownloadProgress(ctx context.Context, sliceHash, fileName, fileHash, savePath, fileReqId string)
SaveDownloadProgress
func SaveFileData ¶
func SaveFileData(ctx context.Context, data []byte, offset int64, sliceHash, fileName, fileHash, savePath, fileReqId string) bool
SaveFileData
func SaveRemoteFileData ¶ added in v0.9.0
SaveRemoteFileData application calls this func to send a slice of file data to remote user during download process
func SaveRemoteFileHash ¶ added in v0.9.0
SaveRemoteFileHash
func SaveSliceData ¶
SaveSliceData
func SaveTmpSliceData ¶ added in v0.8.0
func SendFileDataBack ¶ added in v0.9.0
SendFileDataBack rpc server feeds file data from remote user to application
func SetDownloadSliceDone ¶ added in v0.9.0
func SetDownloadSliceDone(key string)
SetDownloadSliceDone rpc server tells the remote user has received last downloaded slice
func SetFileListResult ¶ added in v0.9.0
func SetFileListResult(key string, result *rpc.FileListResult)
SetFileListResult
func SetFileShareResult ¶ added in v0.9.0
func SetFileShareResult(key string, result *rpc.FileShareResult)
SetFileShareResult
func SetQueryOzoneResult ¶ added in v0.9.0
func SetQueryOzoneResult(key string, result *rpc.GetOzoneResult)
SetQueryOzoneResult
func SetRemoteFileInfo ¶ added in v0.9.0
SetRemoteFileInfo
func SetRemoteFileResult ¶ added in v0.9.0
SetRemoteFileResult application sends the result of previous operation to rpc server
func SubscribeDownloadFileInfo ¶ added in v0.9.0
func SubscribeDownloadSliceDone ¶ added in v0.9.0
SubscribeDownloadSliceDone
func SubscribeGetRemoteFileData ¶ added in v0.9.0
SubscribeGetRemoteFileData application subscribes to remote file data and waits for remote user's feedback
func SubscribeGetSignature ¶ added in v0.9.0
SubscribeGetSignature
func SubscribeRemoteFileEvent ¶ added in v0.9.0
SubscribeRemoteFileEvent rpc server subscribes to events from application. Now, result of operation is the only event
func UnsubscribeDownloadFileInfo ¶ added in v0.9.0
func UnsubscribeDownloadFileInfo(key string)
UnsubscribeDownloadFileInfo
func UnsubscribeDownloadSliceDone ¶ added in v0.9.0
func UnsubscribeDownloadSliceDone(key string)
UnsubscribeDownloadSliceDone
func UnsubscribeGetRemoteFileData ¶ added in v0.9.0
func UnsubscribeGetRemoteFileData(key string)
UnsubscribeGetRemoteFileData unsubscribe after the application finishes receiving the slice of file data
func UnsubscribeGetSignature ¶ added in v0.9.0
func UnsubscribeGetSignature(key string)
UnsubscribeGetSignature
func UnsubscribeRemoteFileEvent ¶ added in v0.9.0
func UnsubscribeRemoteFileEvent(key string)
UnsubscribeRemoteFileEvent rpc server unsubscribes to event from application. Now, result of operation is the only event
func WaitDownloadSliceDone ¶ added in v0.9.0
WaitDownloadSliceDone application waits for remote user to tell that the downloaded slice received