Versions in this module Expand all Collapse all v1 v1.0.2 Jun 12, 2019 Changes in this version + const COMMIT_ENDPOINT + const CONNECTION_ENDPOINT + const DOWNLOAD_ENDPOINT + const FILE_META_ENDPOINT + const FILE_STATS_ENDPOINT + const LATEST_READ_MARKER + const LIST_ENDPOINT + const UPLOAD_ENDPOINT + var FILEEXISTS = errors.New("File already exists") + func CalculateDirHash(d *FileDirInfo) string + func DeleteFile(d *FileDirInfo, path string) error + func GetBlobberJson(b *Blobber) string + func GetFileContentType(out *os.File) (string, error) + func GetJsonFromDirTree(d *FileDirInfo) string + func Hash(text string) string + func HashStringToBytes(hash string) []byte + func MHash(h1 string, h2 string) string + func NewCommitRequest(baseUrl, allocation string, client ClientConfig, body io.Reader) (*http.Request, error) + func NewConnectionId() int64 + func NewDeleteRequest(baseUrl, allocation string, client ClientConfig, body io.Reader) (*http.Request, error) + func NewDownloadRequest(baseUrl, allocation string, client ClientConfig, body io.Reader) (*http.Request, error) + func NewFileMetaRequest(baseUrl string, allocation string, client ClientConfig, body io.Reader) (*http.Request, error) + func NewLatestReadMarkerRequest(baseUrl string, client ClientConfig) (*http.Request, error) + func NewListRequest(baseUrl, allocation string, client ClientConfig, path string) (*http.Request, error) + func NewStatsRequest(baseUrl, allocation string, client ClientConfig, path string) (*http.Request, error) + func NewUploadRequest(baseUrl, allocation string, client ClientConfig, body io.Reader, update bool) (*http.Request, error) + func Now() int64 + func SetBlobberDirTree(b *Blobber, j string) error + func ToHex(buf []byte) string + func VerifyMerklePath(hash string, path *MTPath, root string) bool + type Blobber struct + ConnObj Connection + DirTree FileDirInfo + Id string + ReadCounter int64 + UrlRoot string + func GetBlobbers(j string) ([]Blobber, error) + type ClientConfig struct + Id string + PrivateKey string + PublicKey string + func GetClientConfig(j string) (ClientConfig, error) + type Connection struct + ConnectionId int64 + DirTree FileDirInfo + func (c *Connection) AddFile(path, hash string, size int64) error + func (c *Connection) DeleteFile(path string, size int64) error + func (c *Connection) GetAllocationRoot(timestamp int64) string + func (c *Connection) GetCommitData() string + func (c *Connection) GetSize() int64 + func (c *Connection) Reset() + func (c *Connection) UpdateFile(path, hash string, size int64) error + type DeleteToken struct + AllocationID string + BlobberID string + ClientID string + FilePathHash string + FileRefHash string + Signature string + Size int64 + Status int + Timestamp int64 + func NewDeleteToken() *DeleteToken + func (dt *DeleteToken) GetHash() string + func (dt *DeleteToken) Sign(privateKey string) error + type FileConfig struct + ActualHash string + FileHash hash.Hash + FileHashWr io.Writer + Name string + Path string + Remaining int64 + Size int64 + Type string + func GetFileConfig(j string) (FileConfig, error) + type FileDirInfo struct + Children []FileDirInfo + Hash string + Meta map[string]interface{} + Name string + Size int64 + Type string + func AddDir(d *FileDirInfo, path string) *FileDirInfo + func GetDirTreeFromJson(j string) (FileDirInfo, error) + func GetFileInfo(d *FileDirInfo, path string) *FileDirInfo + func InsertFile(d *FileDirInfo, path, hash string, size int64) (*FileDirInfo, error) + func ListDir(d *FileDirInfo, path string) []FileDirInfo + func NewDirTree() FileDirInfo + func (fi *FileDirInfo) GetInfoHash() string + type Hashable interface + GetHash func() string + GetHashBytes func() []byte + type MTPath struct + LeafIndex int + Nodes []string + type MarkerI interface + GetHash func() string + Sign func(privateKey string) error + type MerkleTree struct + func (mt *MerkleTree) ComputeTree(hashes []Hashable) + func (mt *MerkleTree) GetLeafIndex(hash Hashable) int + func (mt *MerkleTree) GetPath(hash Hashable) *MTPath + func (mt *MerkleTree) GetPathByIndex(idx int) *MTPath + func (mt *MerkleTree) GetRoot() string + func (mt *MerkleTree) GetTree() []string + func (mt *MerkleTree) SetTree(leavesCount int, tree []string) error + func (mt *MerkleTree) VerifyPath(hash Hashable, path *MTPath) bool + type MerkleTreeI interface + ComputeTree func(hashes []Hashable) + GetPath func(hash Hashable) *MTPath + GetPathByIndex func(idx int) *MTPath + GetRoot func() string + GetTree func() []string + SetTree func(leavesCount int, tree []string) error + VerifyPath func(hash Hashable, path *MTPath) bool + type OperationStatus struct + Path string + Size int64 + type ReadMarker struct + AllocationID string + BlobberID string + ClientID string + ClientPublicKey string + OwnerID string + ReadCounter int64 + Signature string + Timestamp int64 + func NewReadMarker() *ReadMarker + func (rm *ReadMarker) GetHash() string + func (rm *ReadMarker) Sign(privateKey string) error + type SecureSerializableValue struct + Buffer []byte + func (spv *SecureSerializableValue) Decode(buf []byte) error + func (spv *SecureSerializableValue) Encode() []byte + func (spv *SecureSerializableValue) GetHash() string + func (spv *SecureSerializableValue) GetHashBytes() []byte + type SecureSerializableValueI interface + type Serializable interface + Decode func([]byte) error + Encode func() []byte + type StringHashable struct + Hash string + func NewStringHashable(hash string) *StringHashable + func (sh *StringHashable) GetHash() string + func (sh *StringHashable) GetHashBytes() []byte + type WriteMarker struct + AllocationID string + AllocationRoot string + BlobberID string + ClientID string + PreviousAllocationRoot string + Signature string + Size int64 + Timestamp int64 + func NewWriteMarker() *WriteMarker + func (wm *WriteMarker) GetHash() string + func (wm *WriteMarker) Sign(privateKey string) error