zbox

package
v1.8.10 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertZcnTokenToETH

func ConvertZcnTokenToETH(token float64) (string, error)

ConvertZcnTokenToETH - converting Zcn tokens to Eth

func Decrypt

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

Decrypt - decrypting text with key

func Encrypt

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

Encrypt - encrypting text with key

func GEthToTokens

func GEthToTokens(tokens int64) string

func GetBlobbers

func GetBlobbers() (string, error)

GetBlobbers - get list of blobbers

func GetClientEncryptedPublicKey

func GetClientEncryptedPublicKey() (string, error)

GetClientEncryptedPublicKey - getting client encrypted pub key

func GetNetwork

func GetNetwork() (string, error)

GetNetwork - get current network

func GetNumber

func GetNumber(value string) int

func Sign

func Sign(hash string) (string, error)

Sign - sign hash

func SuggestEthGasPrice

func SuggestEthGasPrice() (string, error)

SuggestEthGasPrice - return back suggested price for gas

func TokensToEth

func TokensToEth(tokens int64) string

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"`
	// 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

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