zbox

package
v1.13.14 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAllocation = errors.New("zbox: invalid allocation")

Functions

func CancelDownload added in v1.8.12

func CancelDownload(allocationID, remotepath string) error

CancelDownload - cancel file download

## Inputs
- allocationID
- remotePath

func CancelRepair added in v1.8.12

func CancelRepair(allocationID string) error

CancelRepair - cancel repair files from path

## Inputs
- allocationID

func CancelUpload added in v1.8.12

func CancelUpload(allocationID, remotePath string) error

CancelUpload - cancel file upload

## Inputs
- allocationID
- localPath

func ConvertZcnTokenToETH

func ConvertZcnTokenToETH(token float64) (string, error)

ConvertZcnTokenToETH - converting Zcn tokens to Eth

func CopyObject added in v1.8.12

func CopyObject(allocationID, path string, destPath string) error

CopyObject - copy object from path to dest ## Inputs

  • allocationID
  • path
  • destPath

func CreateDir added in v1.8.12

func CreateDir(allocationID, dirName string) error

CreateDir create empty directoy on remote blobbers

## Inputs
- allocationID
- dirName

func Decrypt

func Decrypt(key, text string) (string, error)

Decrypt - decrypting text with key

func DeleteFile added in v1.8.12

func DeleteFile(allocationID, remotePath string) error

DeleteFile - delete file from remote path ## Inputs

  • allocationID
  • remotePath

## Outputs

func DownloadFile added in v1.8.12

func DownloadFile(allocationID, remotePath, localPath string, statusCb StatusCallbackMocked, isFinal bool) error

DownloadFile - start download file from remote path to localpath ## Inputs

  • allocationID
  • remotePath
  • localPath: the full local path of file
  • statusCb: callback of status
  • isFinal: is final download request(for example if u want to download 10 files in parallel, the last one should be true)

## Outputs

  • error

func DownloadFileByBlock added in v1.8.12

func DownloadFileByBlock(allocationID, remotePath, localPath string, startBlock, endBlock int64, numBlocks int, statusCb StatusCallbackMocked, isFinal bool) error

DownloadFileByBlock - start download file from remote path to localpath by blocks number ## Inputs

  • allocationID
  • remotePath
  • localPath
  • startBlock
  • endBlock
  • numBlocks
  • statusCb: callback of status
  • isFinal: is final download request(for example if u want to download 10 files in parallel, the last one should be true)

## Outputs

  • error

func DownloadFromAuthTicket added in v1.8.12

func DownloadFromAuthTicket(allocationID, localPath string, authTicket string, remoteLookupHash string, remoteFilename string, status StatusCallbackMocked, isFinal bool) error

DownloadFromAuthTicket - download file from Auth ticket

## Inputs
- allocationID
- localPath
- authTicket
- remoteLookupHash
- remoteFilename
- status: callback of status

func DownloadFromAuthTicketByBlocks added in v1.8.12

func DownloadFromAuthTicketByBlocks(allocationID, localPath string, authTicket string, startBlock, endBlock int64, numBlocks int, remoteLookupHash string, remoteFilename string, status StatusCallbackMocked, isFinal bool) error

DownloadFromAuthTicketByBlocks - download file from Auth ticket by blocks number ## Inputs

  • allocationID
  • localPath
  • authTicket: the base64 string of *marker.AuthTicket
  • startBlock:
  • endBlock
  • numBlocks
  • remoteLookupHash
  • remoteFilename
  • status: callback of status

func DownloadThumbnail added in v1.8.12

func DownloadThumbnail(allocationID, remotePath, localPath string, statusCb StatusCallbackMocked, isFinal bool) error

DownloadThumbnail - start download file thumbnail from remote path to localpath ## Inputs

  • allocationID
  • remotePath
  • localPath
  • statusCb: callback of status
  • isFinal: is final download request(for example if u want to download 10 files in parallel, the last one should be true)

## Outputs

  • error

func DownloadThumbnailFromAuthTicket added in v1.8.12

func DownloadThumbnailFromAuthTicket(allocationID, localPath string, authTicket string, remoteLookupHash string, remoteFilename string, status StatusCallbackMocked, isFinal bool) error

DownloadThumbnailFromAuthTicket - downloadThumbnail from Auth ticket ## Inputs

  • allocationID
  • localPath
  • authTicket: the base64 string of *marker.AuthTicket
  • remoteLookupHash
  • remoteFilename
  • status: callback of status

func Encrypt

func Encrypt(key, text string) (string, error)

Encrypt - encrypting text with key

func GEthToTokens

func GEthToTokens(tokens int64) string

func GetAllocationStats added in v1.8.12

func GetAllocationStats(allocationID string) (string, error)

GetStatistics - get allocation stats ## Inputs

  • allocationID

## Outputs - the json string of sdk.AllocationStats - error

func GetAuthToken added in v1.8.12

func GetAuthToken(allocationID, path string, filename string, referenceType string, refereeClientID string, refereeEncryptionPublicKey string, expiration int64, availableAfter int64) (string, error)

GetAuthToken - get auth token from refereeClientID ## Inputs

  • allocationID
  • path
  • fileName
  • referenceType: f: file, d: directory
  • refereeClientID
  • refereeEncryptionPublicKey
  • expiration: seconds in unix time
  • availableAfter: seconds in unix time

## Outputs

  • the json string of *marker.AuthTicket
  • error

func GetBlobberStats added in v1.8.12

func GetBlobberStats(allocationID string) (string, error)

GetBlobberStats - get blobbers stats ## Inputs

  • allocationID

## Outputs

  • the json string of map[string]*sdk.BlobberAllocationStats
  • error

func GetBlobbers

func GetBlobbers() (string, error)

GetBlobbers - get list of blobbers

func GetClientEncryptedPublicKey

func GetClientEncryptedPublicKey() (string, error)

GetClientEncryptedPublicKey - getting client encrypted pub key

func GetFileMeta added in v1.8.12

func GetFileMeta(allocationID, path string) (string, error)

GetFileMeta - getting file meta details from file path ## Inputs

  • allocationID
  • remotePath

## Outputs

  • the json string of sdk.ConsolidatedFileMeta
  • error

func GetFileMetaFromAuthTicket added in v1.8.12

func GetFileMetaFromAuthTicket(allocationID, authTicket string, lookupHash string) (string, error)

GetFileMetaFromAuthTicket - getting file meta details from file path and auth ticket ## Inputs

  • allocationID
  • authTicket
  • lookupHash

## Outpus

  • the json string of sdk.ConsolidatedFileMeta
  • error

func GetFileStats added in v1.8.12

func GetFileStats(allocationID, path string) (string, error)

GetFileStats - get file stats from path ## Inputs

  • allocationID
  • path

## Outputs

  • the json string of map[string]*sdk.FileStats

func GetNetwork

func GetNetwork() (string, error)

GetNetwork - get current network

func GetNumber

func GetNumber(value string) int

func GetRemoteFileMap added in v1.8.17

func GetRemoteFileMap(allocationID string) (string, error)

GetRemoteFileMap returns the remote

## Inputs
- allocationID

func ListDir added in v1.8.12

func ListDir(allocationID, remotePath string) (string, error)

ListDir - listing files from path ## Inputs

  • allocatonID
  • remotePath

## Outputs

  • the json string of sdk.ListResult
  • error

func ListDirFromAuthTicket added in v1.8.12

func ListDirFromAuthTicket(allocationID, authTicket string, lookupHash string) (string, error)

ListDirFromAuthTicket - listing files from path with auth ticket ## Inputs

  • allocatonID
  • authTicket
  • lookupHash

## Outputs

  • the json string of sdk.ListResult
  • error

func MoveObject added in v1.8.12

func MoveObject(allocationID, path string, destPath string) error

MoveObject - move object from path to dest ## Inputs

  • allocationID
  • path
  • destPath

func MultiDownload added in v1.8.17

func MultiDownload(allocationID, jsonMultiDownloadOptions string, statusCb StatusCallbackMocked) error

func MultiDownloadFromAuthTicket added in v1.8.17

func MultiDownloadFromAuthTicket(allocationID, authTicket, jsonMultiDownloadOptions string, status StatusCallbackMocked) error

func MultiOperation added in v1.8.17

func MultiOperation(allocationID string, jsonMultiOperationOptions string) error

MultiOperation - do copy, move, delete and createdir operation together ## Inputs

  • allocationID
  • jsonMultiOperationOptions: Json Array of MultiOperationOption. eg: "[{"operationType":"move","remotePath":"/README.md","destPath":"/folder1/"},{"operationType":"delete","remotePath":"/t3.txt"}]"

## Outputs

  • error

func MultiUpdate added in v1.8.17

func MultiUpdate(allocationID string, workdir string, jsonMultiUploadOptions string, statusCb StatusCallbackMocked) error

MultiUpdateFile - update files from local path to remote path ## Inputs

  • allocationID
  • workdir: set a workdir as ~/.zcn on mobile apps
  • jsonMultiUploadOpetions: Json Array of MultiOperationOption. eg: "[{"remotePath":"/","filePath":"/t2.txt"},{"remotePath":"/","filePath":"/t3.txt"}]"

## Outputs

  • error

func MultiUpload added in v1.8.17

func MultiUpload(allocationID string, workdir string, jsonMultiUploadOptions string, statusCb StatusCallbackMocked) error

MultiUploadFile - upload files from local path to remote path ## Inputs

  • allocationID
  • workdir: set a workdir as ~/.zcn on mobile apps
  • jsonMultiUploadOpetions: Json Array of MultiOperationOption. eg: "[{"remotePath":"/","filePath":"/t2.txt"},{"remotePath":"/","filePath":"/t3.txt"}]"

## Outputs

  • error

func RenameObject added in v1.8.12

func RenameObject(allocationID, remotePath string, destName string) error

RenameObject - rename or move file ## Inputs

  • allocationID
  • remotePath
  • destName

## Outputs

  • error

func RepairFile added in v1.8.12

func RepairFile(allocationID, workdir, localPath, remotePath, thumbnailPath string, encrypt bool, webStreaming bool, statusCb StatusCallbackMocked) error

RepairFile - repair file if it exists in remote path ## Inputs

  • allocationID
  • workdir: set a workdir as ~/.zcn on mobile apps
  • localPath: the local full path of file. eg /usr/local/files/zcn.png
  • remotePath:
  • thumbnailPath: the local full path of thumbnail
  • encrypt: the file should be ecnrypted or not on uploading
  • statusCb: callback of status

## Outputs

  • error

func RevokeShare added in v1.8.17

func RevokeShare(allocationID, path, refereeClientID string) error

RevokeShare revoke authTicket

## Inputs
- allocationID
- path
- refereeClientID

func SetMultiOpBatchSize added in v1.11.4

func SetMultiOpBatchSize(size int)

func SetWorkingDir added in v1.11.4

func SetWorkingDir(workDir string)

SetWorkingDir set working dir

## Inputs
- workDir

func Sign

func Sign(hash string) (string, error)

Sign - sign hash

func StartRepair added in v1.8.12

func StartRepair(allocationID, localRootPath, pathToRepair string, statusCb StatusCallbackMocked) error

StartRepair - start repair files from path

## Inputs
- allocationID
- localRootPath
- pathToRepair
- status: callback of status

func SuggestEthGasPrice

func SuggestEthGasPrice() (string, error)

SuggestEthGasPrice - return back suggested price for gas

func TokensToEth

func TokensToEth(tokens int64) string

func UpdateFile added in v1.8.12

func UpdateFile(allocationID, workdir, localPath, remotePath, thumbnailPath string, encrypt bool, webStreaming bool, statusCb StatusCallbackMocked) error

UploadFile - update file/thumbnail from local path to remote path ## Inputs

  • workdir: set a workdir as ~/.zcn on mobile apps
  • localPath: the local full path of file. eg /usr/local/files/zcn.png
  • remotePath:
  • thumbnailPath: the local full path of thumbnail
  • encrypt: the file should be ecnrypted or not on uploading
  • statusCb: callback of status

## Ouputs

  • error

func UploadFile added in v1.8.12

func UploadFile(allocationID, workdir, localPath, remotePath, thumbnailPath string, encrypt bool, webStreaming bool, statusCb StatusCallbackMocked) error

UploadFile - upload file/thumbnail from local path to remote path ## Inputs

  • allocationID
  • workdir: set a workdir as ~/.zcn on mobile apps
  • localPath: the local full path of file. eg /usr/local/files/zcn.png
  • remotePath:
  • thumbnailPath: the local full path of thumbnail
  • encrypt: the file should be ecnrypted or not on uploading
  • statusCb: callback of status

## Outputs

  • error

func VerifySignature

func VerifySignature(signature string, msg string) (bool, error)

VerifySignatxure - verify message with signature

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"`
	MinLockDemand float64 `json:"min_lock_demand"`
	// 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) 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, isFinal bool) error

DownloadFile - start download file from remote path to localpath isFinal- set true if this is the last file to download otherwise false when set to true it will start the download for all files in the queue

func (*Allocation) DownloadFileByBlock

func (a *Allocation) DownloadFileByBlock(remotePath, localPath string, startBlock, endBlock int64, numBlocks int, statusCb StatusCallbackMocked, isFinal bool) error

DownloadFileByBlock - start download file from remote path to localpath by blocks number isFinal- set true if this is the last file to download otherwise false when set to true it will start the download for all files in the queue

func (*Allocation) DownloadFromAuthTicket

func (a *Allocation) DownloadFromAuthTicket(localPath string, authTicket string, remoteLookupHash string, remoteFilename string, status StatusCallbackMocked, isFinal bool) 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, isFinal bool) error

DownloadFromAuthTicketByBlocks - download file from Auth ticket by blocks number

func (*Allocation) DownloadThumbnail

func (a *Allocation) DownloadThumbnail(remotePath, localPath string, statusCb StatusCallbackMocked, isFinal bool) error

DownloadThumbnail - start download file thumbnail from remote path to localpath isFinal- set true if this is the last file to download otherwise false when set to true it will start the download for all files in the queue

func (*Allocation) DownloadThumbnailFromAuthTicket

func (a *Allocation) DownloadThumbnailFromAuthTicket(localPath string, authTicket string, remoteLookupHash string, remoteFilename string, status StatusCallbackMocked, isFinal bool) error

DownloadThumbnailFromAuthTicket - downloadThumbnail from Auth ticket

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, availableAfter string) (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

func (*Allocation) RenameObject

func (a *Allocation) RenameObject(remotePath string, destName string) error

RenameObject - rename or move file

func (*Allocation) RepairFile

func (a *Allocation) RepairFile(workdir, localPath, remotePath, thumbnailPath string, encrypt bool, webStreaming bool, statusCb StatusCallbackMocked) error

RepairFile - repair file if it exists in remote path ## Inputs

  • workdir: set a workdir as ~/.zcn on mobile apps
  • localPath: the local full path of file. eg /usr/local/files/zcn.png
  • remotePath:
  • thumbnailPath: the local full path of thumbnail
  • encrypt: the file should be ecnrypted or not on uploading
  • statusCb: callback of status

func (*Allocation) RevokeShare added in v1.8.13

func (a *Allocation) RevokeShare(path string, refereeClientID string) error

RevokeShare - revokes authTicket from refereeClientID

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, thumbnailPath string, encrypt bool, webStreaming bool, statusCb StatusCallbackMocked) error

UploadFile - update file/thumbnail from local path to remote path ## Inputs

  • workdir: set a workdir as ~/.zcn on mobile apps
  • localPath: the local full path of file. eg /usr/local/files/zcn.png
  • remotePath:
  • thumbnailPath: the local full path of thumbnail
  • encrypt: the file should be ecnrypted or not on uploading
  • statusCb: callback of status

func (*Allocation) UploadFile

func (a *Allocation) UploadFile(workdir, localPath, remotePath, thumbnailPath string, encrypt bool, webStreaming bool, statusCb StatusCallbackMocked) error

UploadFile - upload file/thumbnail from local path to remote path ## Inputs

  • workdir: set a workdir as ~/.zcn on mobile apps
  • localPath: the local full path of file. eg /usr/local/files/zcn.png
  • remotePath:
  • thumbnailPath: the local full path of thumbnail
  • encrypt: the file should be ecnrypted or not on uploading
  • statusCb: callback of status

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

func (*AuthTicket) IsDir

func (at *AuthTicket) IsDir() (bool, error)

IsDir - checking if it's dir

type M3u8Downloader

type M3u8Downloader struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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 MediaItem

type MediaItem struct {
	Name string
	Path string
}

MediaItem is .ts file

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)

func (*MediaPlaylist) Append

func (m *MediaPlaylist) Append(item string)

Append append new item

func (*MediaPlaylist) Encode

func (m *MediaPlaylist) Encode() []byte

Encode encode m3u8

func (*MediaPlaylist) Play

func (m *MediaPlaylist) Play()

Play start to push item into playlist

func (*MediaPlaylist) String

func (m *MediaPlaylist) String() string

String implement Stringer

type MinMaxCost

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

MinMaxCost - keeps cost for allocation update/creation

type MultiDownloadOption added in v1.8.17

type MultiDownloadOption struct {
	RemotePath       string `json:"remotePath"`
	LocalPath        string `json:"localPath"`
	DownloadOp       int    `json:"downloadOp"`
	RemoteFileName   string `json:"remoteFileName,omitempty"`   //Required only for file download with auth ticket
	RemoteLookupHash string `json:"remoteLookupHash,omitempty"` //Required only for file download with auth ticket
}

type MultiOperationOption added in v1.8.17

type MultiOperationOption struct {
	OperationType string `json:"operationType,omitempty"`
	RemotePath    string `json:"remotePath,omitempty"`
	DestName      string `json:"destName,omitempty"` // Required only for rename operation
	DestPath      string `json:"destPath,omitempty"` // Required for copy and move operation`
}

type MultiUploadOption added in v1.8.17

type MultiUploadOption struct {
	FilePath       string `json:"filePath,omitempty"`
	FileName       string `json:"fileName,omitempty"`
	RemotePath     string `json:"remotePath,omitempty"`
	ThumbnailPath  string `json:"thumbnailPath,omitempty"`
	Encrypt        bool   `json:"encrypt,omitempty"`
	ChunkNumber    int    `json:"chunkNumber,omitempty"`
	IsUpdate       bool   `json:"isUpdate,omitempty"`
	IsWebstreaming bool   `json:"isWebstreaming,omitempty"`
}

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) Completed

func (s *StatusBarMocked) Completed(allocationId, filePath string, filename string, mimetype string, size int, op int)

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)

func (*StatusBarMocked) Started

func (s *StatusBarMocked) Started(allocationId, filePath string, op int, totalBytes 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) Completed

func (c *StatusCallbackWrapped) Completed(allocationId, filePath string, filename string, mimetype string, size int, op int)

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)

func (*StatusCallbackWrapped) Started

func (c *StatusCallbackWrapped) Started(allocationId, filePath string, op int, totalBytes 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

func (*StreamingService) Stop

func (s *StreamingService) Stop() error

TODO

Jump to

Keyboard shortcuts

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