Documentation
¶
Index ¶
- func ConvertZcnTokenToETH(token float64) (string, error)
- func Decrypt(key, text string) (string, error)
- func Encrypt(key, text string) (string, error)
- func GEthToTokens(tokens int64) string
- func GetBlobbers() (string, error)
- func GetClientEncryptedPublicKey() (string, error)
- func GetNetwork() (string, error)
- func GetNumber(value string) int
- func Sign(hash string) (string, error)
- func SuggestEthGasPrice() (string, error)
- func TokensToEth(tokens int64) string
- func VerifySignature(signature string, msg string) (bool, error)
- type Allocation
- func (a *Allocation) CancelDownload(remotepath string) error
- func (a *Allocation) CancelRepair() error
- func (a *Allocation) CancelUpload(localpath string) error
- func (a *Allocation) CopyObject(path string, destPath string) error
- func (a *Allocation) CreateDir(dirName string) error
- func (a *Allocation) DeleteFile(remotePath string) error
- func (a *Allocation) DownloadFile(remotePath, localPath string, statusCb StatusCallbackMocked) error
- func (a *Allocation) DownloadFileByBlock(remotePath, localPath string, startBlock, endBlock int64, numBlocks int, ...) error
- func (a *Allocation) DownloadFromAuthTicket(localPath string, authTicket string, remoteLookupHash string, ...) error
- func (a *Allocation) DownloadFromAuthTicketByBlocks(localPath string, authTicket string, startBlock, endBlock int64, numBlocks int, ...) error
- func (a *Allocation) DownloadThumbnail(remotePath, localPath string, statusCb StatusCallbackMocked) error
- func (a *Allocation) DownloadThumbnailFromAuthTicket(localPath string, authTicket string, remoteLookupHash string, ...) error
- func (a *Allocation) EncryptAndUpdateFile(tmpPath, localPath, remotePath, fileAttrs string, ...) error
- func (a *Allocation) EncryptAndUpdateFileWithThumbnail(tmpPath, localPath, remotePath, fileAttrs string, thumbnailpath string, ...) error
- func (a *Allocation) EncryptAndUploadFile(tmpPath, localPath, remotePath, fileAttrs string, ...) error
- func (a *Allocation) EncryptAndUploadFileWithThumbnail(tmpPath, localPath, remotePath, fileAttrs string, thumbnailpath string, ...) error
- func (a *Allocation) GetAllocationStats() (string, error)
- func (a *Allocation) GetAuthToken(path string, filename string, referenceType string, refereeClientID string, ...) (string, error)
- func (a *Allocation) GetBlobberStats() (string, error)
- func (a *Allocation) GetCurrentManifest() string
- func (a *Allocation) GetDiff(lastSyncCachePath string, localRootPath string, localFileFilters string, ...) (string, error)
- func (a *Allocation) GetFileMeta(path string) (string, error)
- func (a *Allocation) GetFileMetaFromAuthTicket(authTicket string, lookupHash string) (string, error)
- func (a *Allocation) GetFileStats(path string) (string, error)
- func (a *Allocation) GetFirstSegment(localPath, remotePath, tmpPath string, delay, maxSegments int) (string, error)
- func (a *Allocation) GetMaxStorageCost(size int64) (string, error)
- func (a *Allocation) GetMaxStorageCostWithBlobbers(size int64, blobbersJson string) (string, error)
- func (a *Allocation) GetMinStorageCost(size int64) (string, error)
- func (a *Allocation) GetMinWriteRead() (string, error)
- func (a *Allocation) GetShareAuthToken(path string, filename string, referenceType string, refereeClientID string) (string, error)
- func (a *Allocation) ListDir(path string) (string, error)
- func (a *Allocation) ListDirFromAuthTicket(authTicket string, lookupHash string) (string, error)
- func (a *Allocation) MoveObject(path string, destPath string) error
- func (a *Allocation) PlayStreaming(localPath, remotePath, authTicket, lookupHash, initSegment string, delay int, ...) error
- func (a *Allocation) RenameObject(remotePath string, destName string) error
- func (a *Allocation) RepairFile(localPath, remotePath string, statusCb StatusCallbackMocked) error
- func (a *Allocation) SaveRemoteSnapshot(pathToSave string, remoteExcludePaths string) error
- func (a *Allocation) StartRepair(localRootPath, pathToRepair string, statusCb StatusCallbackMocked) error
- func (a *Allocation) StopStreaming() error
- func (a *Allocation) UpdateFile(workDir, localPath, remotePath, fileAttrs string, ...) error
- func (a *Allocation) UpdateFileWithThumbnail(workDir, localPath, remotePath, fileAttrs string, thumbnailpath string, ...) error
- func (a *Allocation) UploadFile(workdir, localPath, remotePath, fileAttrs string, ...) error
- func (a *Allocation) UploadFileWithThumbnail(tmpPath, localPath, remotePath, fileAttrs string, thumbnailpath string, ...) error
- type AuthTicket
- type M3u8Downloader
- type M3u8Writer
- type MediaItem
- type MediaPlaylist
- type MinMaxCost
- type StatusBarMocked
- func (s *StatusBarMocked) CommitMetaCompleted(request, response string, txn *transaction.Transaction, err error)
- func (s *StatusBarMocked) Completed(allocationId, filePath string, filename string, mimetype string, size int, ...)
- func (s *StatusBarMocked) Error(allocationID string, filePath string, op int, err error)
- func (s *StatusBarMocked) InProgress(allocationId, filePath string, op int, completedBytes int, data []byte)
- func (s *StatusBarMocked) RepairCompleted(filesRepaired int)
- func (s *StatusBarMocked) Started(allocationId, filePath string, op int, totalBytes int)
- type StatusCallbackMocked
- type StatusCallbackWrapped
- func (c *StatusCallbackWrapped) CommitMetaCompleted(request, response string, txn *transaction.Transaction, err error)
- func (c *StatusCallbackWrapped) Completed(allocationId, filePath string, filename string, mimetype string, size int, ...)
- func (c *StatusCallbackWrapped) Error(allocationID string, filePath string, op int, err error)
- func (c *StatusCallbackWrapped) InProgress(allocationId, filePath string, op int, completedBytes int, data []byte)
- func (c *StatusCallbackWrapped) RepairCompleted(filesRepaired int)
- func (c *StatusCallbackWrapped) Started(allocationId, filePath string, op int, totalBytes int)
- type StreamingImpl
- type StreamingService
- func (s *StreamingService) GetCurrentManifest() string
- func (s *StreamingService) GetFirstSegment(localPath, remotePath, tmpPath string, delay, maxSegments int) (string, error)
- func (s *StreamingService) PlayStreaming(localPath, remotePath, authTicket, lookupHash, initSegment string, delay int, ...) error
- func (s *StreamingService) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertZcnTokenToETH ¶
ConvertZcnTokenToETH - converting Zcn tokens to Eth
func GEthToTokens ¶
func GetClientEncryptedPublicKey ¶
GetClientEncryptedPublicKey - getting client encrypted pub key
func SuggestEthGasPrice ¶
SuggestEthGasPrice - return back suggested price for gas
func TokensToEth ¶
Types ¶
type Allocation ¶
type Allocation struct { ID string `json:"id"` DataShards int `json:"data_shards"` ParityShards int `json:"parity_shards"` Size int64 `json:"size"` Expiration int64 `json:"expiration_date"` Name string `json:"name"` Stats string `json:"stats"` // contains filtered or unexported fields }
Allocation - structure for allocation object
func ToAllocation ¶
func ToAllocation(sdkAllocation *sdk.Allocation) *Allocation
func (*Allocation) CancelDownload ¶
func (a *Allocation) CancelDownload(remotepath string) error
CancelDownload - cancel file download
func (*Allocation) CancelRepair ¶
func (a *Allocation) CancelRepair() error
CancelRepair - cancel repair files from path
func (*Allocation) CancelUpload ¶
func (a *Allocation) CancelUpload(localpath string) error
CancelUpload - cancel file upload
func (*Allocation) CopyObject ¶
func (a *Allocation) CopyObject(path string, destPath string) error
CopyObject - copy object from path to dest
func (*Allocation) CreateDir ¶
func (a *Allocation) CreateDir(dirName string) error
func (*Allocation) DeleteFile ¶
func (a *Allocation) DeleteFile(remotePath string) error
DeleteFile - delete file from remote path
func (*Allocation) DownloadFile ¶
func (a *Allocation) DownloadFile(remotePath, localPath string, statusCb StatusCallbackMocked) error
DownloadFile - start download file from remote path to localpath
func (*Allocation) DownloadFileByBlock ¶
func (a *Allocation) DownloadFileByBlock(remotePath, localPath string, startBlock, endBlock int64, numBlocks int, statusCb StatusCallbackMocked) error
DownloadFileByBlock - start download file from remote path to localpath by blocks number
func (*Allocation) DownloadFromAuthTicket ¶
func (a *Allocation) DownloadFromAuthTicket(localPath string, authTicket string, remoteLookupHash string, remoteFilename string, status StatusCallbackMocked) error
DownloadFromAuthTicket - download file from Auth ticket
func (*Allocation) DownloadFromAuthTicketByBlocks ¶
func (a *Allocation) DownloadFromAuthTicketByBlocks(localPath string, authTicket string, startBlock, endBlock int64, numBlocks int, remoteLookupHash string, remoteFilename string, status StatusCallbackMocked) error
DownloadFromAuthTicketByBlocks - download file from Auth ticket by blocks number
func (*Allocation) DownloadThumbnail ¶
func (a *Allocation) DownloadThumbnail(remotePath, localPath string, statusCb StatusCallbackMocked) error
DownloadThumbnail - start download file thumbnail from remote path to localpath
func (*Allocation) DownloadThumbnailFromAuthTicket ¶
func (a *Allocation) DownloadThumbnailFromAuthTicket(localPath string, authTicket string, remoteLookupHash string, remoteFilename string, status StatusCallbackMocked) error
DownloadThumbnailFromAuthTicket - downloadThumbnail from Auth ticket
func (*Allocation) EncryptAndUpdateFile ¶
func (a *Allocation) EncryptAndUpdateFile(tmpPath, localPath, remotePath, fileAttrs string, statusCb StatusCallbackMocked) error
EncryptAndUpdateFile - update file from local path to remote path from encrypted folder
func (*Allocation) EncryptAndUpdateFileWithThumbnail ¶
func (a *Allocation) EncryptAndUpdateFileWithThumbnail(tmpPath, localPath, remotePath, fileAttrs string, thumbnailpath string, statusCb StatusCallbackMocked) error
EncryptAndUpdateFileWithThumbnail - update file from local path to remote path from encrypted folder with Thumbnail
func (*Allocation) EncryptAndUploadFile ¶
func (a *Allocation) EncryptAndUploadFile(tmpPath, localPath, remotePath, fileAttrs string, statusCb StatusCallbackMocked) error
EncryptAndUploadFile - start upload encrypted file
func (*Allocation) EncryptAndUploadFileWithThumbnail ¶
func (a *Allocation) EncryptAndUploadFileWithThumbnail(tmpPath, localPath, remotePath, fileAttrs string, thumbnailpath string, statusCb StatusCallbackMocked) error
EncryptAndUploadFileWithThumbnail - start upload encrypted file with thumbnail
func (*Allocation) GetAllocationStats ¶
func (a *Allocation) GetAllocationStats() (string, error)
GetStatistics - get allocation stats
func (*Allocation) GetAuthToken ¶
func (a *Allocation) GetAuthToken(path string, filename string, referenceType string, refereeClientID string, refereeEncryptionPublicKey string, expiration int64) (string, error)
GetAuthToken - get auth token from refereeClientID
func (*Allocation) GetBlobberStats ¶
func (a *Allocation) GetBlobberStats() (string, error)
GetBlobberStats - get blobbers stats
func (*Allocation) GetCurrentManifest ¶
func (a *Allocation) GetCurrentManifest() string
func (*Allocation) GetDiff ¶
func (a *Allocation) GetDiff(lastSyncCachePath string, localRootPath string, localFileFilters string, remoteExcludePaths string) (string, error)
GetDiff - cancel file diff
func (*Allocation) GetFileMeta ¶
func (a *Allocation) GetFileMeta(path string) (string, error)
GetFileMeta - getting file meta details from file path
func (*Allocation) GetFileMetaFromAuthTicket ¶
func (a *Allocation) GetFileMetaFromAuthTicket(authTicket string, lookupHash string) (string, error)
GetFileMetaFromAuthTicket - getting file meta details from file path and auth ticket
func (*Allocation) GetFileStats ¶
func (a *Allocation) GetFileStats(path string) (string, error)
GetFileStats - get file stats from path
func (*Allocation) GetFirstSegment ¶
func (a *Allocation) GetFirstSegment(localPath, remotePath, tmpPath string, delay, maxSegments int) (string, error)
GetFirstSegment - getting the amount of segments in maxSegments for very first playback
func (*Allocation) GetMaxStorageCost ¶
func (a *Allocation) GetMaxStorageCost(size int64) (string, error)
GetMaxStorageCost - getting back max cost for allocation
func (*Allocation) GetMaxStorageCostWithBlobbers ¶
func (a *Allocation) GetMaxStorageCostWithBlobbers(size int64, blobbersJson string) (string, error)
GetMaxStorageCostWithBlobbers - getting cost for listed blobbers
func (*Allocation) GetMinStorageCost ¶
func (a *Allocation) GetMinStorageCost(size int64) (string, error)
GetMinStorageCost - getting back min cost for allocation
func (*Allocation) GetMinWriteRead ¶
func (a *Allocation) GetMinWriteRead() (string, error)
GetMinWriteRead - getting back cost for allocation
func (*Allocation) GetShareAuthToken ¶
func (a *Allocation) GetShareAuthToken(path string, filename string, referenceType string, refereeClientID string) (string, error)
GetShareAuthToken - get auth ticket from refereeClientID
func (*Allocation) ListDir ¶
func (a *Allocation) ListDir(path string) (string, error)
ListDir - listing files from path
func (*Allocation) ListDirFromAuthTicket ¶
func (a *Allocation) ListDirFromAuthTicket(authTicket string, lookupHash string) (string, error)
ListDirFromAuthTicket - listing files from path with auth ticket
func (*Allocation) MoveObject ¶
func (a *Allocation) MoveObject(path string, destPath string) error
MoveObject - move object from path to dest
func (*Allocation) PlayStreaming ¶
func (a *Allocation) PlayStreaming(localPath, remotePath, authTicket, lookupHash, initSegment string, delay int, statusCb StatusCallbackWrapped) error
GetMinStorageCost - getting back min cost for allocation
func (*Allocation) RenameObject ¶
func (a *Allocation) RenameObject(remotePath string, destName string) error
RenameObject - rename or move file
func (*Allocation) RepairFile ¶
func (a *Allocation) RepairFile(localPath, remotePath string, statusCb StatusCallbackMocked) error
RepairFile - repairing file if it's exist in remote path
func (*Allocation) SaveRemoteSnapshot ¶
func (a *Allocation) SaveRemoteSnapshot(pathToSave string, remoteExcludePaths string) error
SaveRemoteSnapshot - saving remote snapshot
func (*Allocation) StartRepair ¶
func (a *Allocation) StartRepair(localRootPath, pathToRepair string, statusCb StatusCallbackMocked) error
StartRepair - start repair files from path
func (*Allocation) StopStreaming ¶
func (a *Allocation) StopStreaming() error
func (*Allocation) UpdateFile ¶
func (a *Allocation) UpdateFile(workDir, localPath, remotePath, fileAttrs string, statusCb StatusCallbackMocked) error
UpdateFile - update file from local path to remote path
func (*Allocation) UpdateFileWithThumbnail ¶
func (a *Allocation) UpdateFileWithThumbnail(workDir, localPath, remotePath, fileAttrs string, thumbnailpath string, statusCb StatusCallbackMocked) error
UpdateFileWithThumbnail - update file from local path to remote path with Thumbnail
func (*Allocation) UploadFile ¶
func (a *Allocation) UploadFile(workdir, localPath, remotePath, fileAttrs string, statusCb StatusCallbackMocked) error
UploadFile - start upload file thumbnail from localpath to remote path
func (*Allocation) UploadFileWithThumbnail ¶
func (a *Allocation) UploadFileWithThumbnail(tmpPath, localPath, remotePath, fileAttrs string, thumbnailpath string, statusCb StatusCallbackMocked) error
UploadFileWithThumbnail - start upload file with thumbnail
type AuthTicket ¶
type AuthTicket struct {
// contains filtered or unexported fields
}
AuthTicket - auth ticket structure
func InitAuthTicket ¶
func InitAuthTicket(authTicket string) *AuthTicket
InitAuthTicket - init auth ticket from ID
func (*AuthTicket) GetFilename ¶
func (at *AuthTicket) GetFilename() (string, error)
GetFilename - getting file name
type M3u8Downloader ¶
M3u8Downloader download files from blobber's dir, and build them into a local m3u8 playlist
type M3u8Writer ¶
type M3u8Writer interface { io.WriteSeeker Truncate(size int64) error Sync() error }
M3u8Writer m3u8 writer
type MediaPlaylist ¶
type MediaPlaylist struct { Writer M3u8Writer Wait []string Seq int // contains filtered or unexported fields }
MediaPlaylist m3u8 encoder and decoder
func NewMediaPlaylist ¶
func NewMediaPlaylist(delay int, writer M3u8Writer) *MediaPlaylist
NewMediaPlaylist create media playlist(.m3u8)
type MinMaxCost ¶
type MinMaxCost struct {
// contains filtered or unexported fields
}
MinMaxCost - keeps cost for allocation update/creation
type StatusBarMocked ¶
type StatusBarMocked struct {
// contains filtered or unexported fields
}
func (*StatusBarMocked) CommitMetaCompleted ¶
func (s *StatusBarMocked) CommitMetaCompleted(request, response string, txn *transaction.Transaction, err error)
func (*StatusBarMocked) Error ¶
func (s *StatusBarMocked) Error(allocationID string, filePath string, op int, err error)
func (*StatusBarMocked) InProgress ¶
func (s *StatusBarMocked) InProgress(allocationId, filePath string, op int, completedBytes int, data []byte)
func (*StatusBarMocked) RepairCompleted ¶
func (s *StatusBarMocked) RepairCompleted(filesRepaired int)
type StatusCallbackMocked ¶
type StatusCallbackMocked interface { Started(allocationId, filePath string, op int, totalBytes int) InProgress(allocationId, filePath string, op int, completedBytes int, data []byte) Error(allocationID string, filePath string, op int, err error) Completed(allocationId, filePath string, filename string, mimetype string, size int, op int) CommitMetaCompleted(request, response string, err error) RepairCompleted(filesRepaired int) }
type StatusCallbackWrapped ¶
type StatusCallbackWrapped struct {
Callback StatusCallbackMocked
}
func (*StatusCallbackWrapped) CommitMetaCompleted ¶
func (c *StatusCallbackWrapped) CommitMetaCompleted(request, response string, txn *transaction.Transaction, err error)
func (*StatusCallbackWrapped) Error ¶
func (c *StatusCallbackWrapped) Error(allocationID string, filePath string, op int, err error)
func (*StatusCallbackWrapped) InProgress ¶
func (c *StatusCallbackWrapped) InProgress(allocationId, filePath string, op int, completedBytes int, data []byte)
func (*StatusCallbackWrapped) RepairCompleted ¶
func (c *StatusCallbackWrapped) RepairCompleted(filesRepaired int)
type StreamingImpl ¶
type StreamingImpl interface { GetFirstSegment(localPath, remotePath, tmpPath string, delay, maxSegments int) (string, error) PlayStreaming(localPath, remotePath, authTicket, lookupHash, initSegment string, delay int, statusCb StatusCallbackWrapped) error Stop() error GetCurrentManifest() string }
StreamingService - implementation of streaming service
func CreateStreamingService ¶
func CreateStreamingService(allocation *Allocation) StreamingImpl
CreateStreamingService - creating streaming service instance
type StreamingService ¶
type StreamingService struct {
// contains filtered or unexported fields
}
StreamingService - holder for streaming service
func (*StreamingService) GetCurrentManifest ¶
func (s *StreamingService) GetCurrentManifest() string
func (*StreamingService) GetFirstSegment ¶
func (s *StreamingService) GetFirstSegment(localPath, remotePath, tmpPath string, delay, maxSegments int) (string, error)
GetFirstSegment - getting the amount of segments in maxSegments for very first playback
func (*StreamingService) PlayStreaming ¶
func (s *StreamingService) PlayStreaming(localPath, remotePath, authTicket, lookupHash, initSegment string, delay int, statusCb StatusCallbackWrapped) error
PlayStreaming - start streaming playback