Documentation
¶
Index ¶
- Constants
- func GetListingFieldsMap(refEntity interface{}, tagName string) map[string]interface{}
- func GetReferenceLookup(allocationID string, path string) string
- func GetSubDirsFromPath(p string) []string
- type CommitResult
- type LatestPrevWriteMarker
- type Ref
- func (r *Ref) CalculateDirHash(ctx context.Context) (string, error)
- func (fr *Ref) CalculateFileHash(ctx context.Context) (string, error)
- func (r *Ref) CalculateHash(ctx context.Context) (string, error)
- func (fr *Ref) GetFileHashData() string
- func (r *Ref) GetListingData(ctx context.Context) map[string]interface{}
- type ReferencePath
- type ReferencePathResult
- type UploadFormData
- type UploadResult
- type WriteMarker
Constants ¶
View Source
const ( // FileRef represents a file FILE = "f" // FileRef represents a directory DIRECTORY = "d" CHUNK_SIZE = 64 * 1024 DIR_LIST_TAG = "dirlist" FILE_LIST_TAG = "filelist" )
Variables ¶
This section is empty.
Functions ¶
func GetListingFieldsMap ¶
func GetReferenceLookup ¶
GetReferenceLookup hash(allocationID + ":" + path) which is used to lookup the file reference in the db.
- allocationID is the allocation ID.
- path is the path of the file.
func GetSubDirsFromPath ¶
Types ¶
type CommitResult ¶
type CommitResult struct {
AllocationRoot string `json:"allocation_root"`
WriteMarker *WriteMarker `json:"write_marker"`
Success bool `json:"success"`
ErrorMessage string `json:"error_msg,omitempty"`
}
type LatestPrevWriteMarker ¶ added in v1.8.17
type LatestPrevWriteMarker struct {
LatestWM *marker.WriteMarker `json:"latest_write_marker"`
PrevWM *marker.WriteMarker `json:"prev_write_marker"`
}
type Ref ¶
type Ref struct {
Type string `gorm:"column:type" dirlist:"type" filelist:"type"`
AllocationID string `gorm:"column:allocation_id"`
LookupHash string `gorm:"column:lookup_hash" dirlist:"lookup_hash" filelist:"lookup_hash"`
Name string `gorm:"column:name" dirlist:"name" filelist:"name"`
Path string `gorm:"column:path" dirlist:"path" filelist:"path"`
Hash string `gorm:"column:hash" dirlist:"hash" filelist:"hash"`
NumBlocks int64 `gorm:"column:num_of_blocks" dirlist:"num_of_blocks" filelist:"num_of_blocks"`
PathHash string `gorm:"column:path_hash" dirlist:"path_hash" filelist:"path_hash"`
ParentPath string `gorm:"column:parent_path"`
PathLevel int `gorm:"column:level"`
ValidationRoot string `gorm:"column:validation_root" filelist:"validation_root"`
Size int64 `gorm:"column:size" dirlist:"size" filelist:"size"`
FixedMerkleRoot string `gorm:"column:fixed_merkle_root" filelist:"fixed_merkle_root"`
ActualFileSize int64 `gorm:"column:actual_file_size" filelist:"actual_file_size"`
ActualFileHash string `gorm:"column:actual_file_hash" filelist:"actual_file_hash"`
Children []*Ref `gorm:"-"`
ChunkSize int64 `gorm:"column:chunk_size" dirlist:"chunk_size" filelist:"chunk_size"`
// contains filtered or unexported fields
}
func (*Ref) CalculateFileHash ¶
func (*Ref) GetFileHashData ¶
type ReferencePath ¶
type ReferencePath struct {
Meta map[string]interface{} `json:"meta_data"`
List []*ReferencePath `json:"list,omitempty"`
Ref *Ref
}
type ReferencePathResult ¶
type ReferencePathResult struct {
*ReferencePath
LatestWM *WriteMarker `json:"latest_write_marker"`
}
func BuildReferencePathResult ¶
func BuildReferencePathResult(rootRef *Ref) *ReferencePathResult
type UploadFormData ¶
type UploadFormData struct {
ConnectionID string `json:"connection_id,omitempty"`
// Filename remote file name
Filename string `json:"filename,omitempty"`
// Path remote path
Path string `json:"filepath,omitempty"`
// ValidationRoot of shard data (encoded,encrypted) where leaf is sha256 hash of 64KB data
ValidationRoot string `json:"validation_root,omitempty"`
// Hash hash of shard thumbnail (encoded,encrypted)
ThumbnailContentHash string `json:"thumbnail_content_hash,omitempty"`
// FixedMerkleRoot merkle root of shard data (encoded, encrypted)
FixedMerkleRoot string `json:"fixed_merkle_root,omitempty"`
// ActualHash hash of orignial file (unencoded, unencrypted)
ActualHash string `json:"actual_hash,omitempty"`
// ActualSize total bytes of orignial file (unencoded, unencrypted)
ActualSize int64 `json:"actual_size,omitempty"`
// ActualThumbnailSize total bytes of orignial thumbnail (unencoded, unencrypted)
ActualThumbSize int64 `json:"actual_thumb_size,omitempty"`
// ActualThumbnailHash hash of orignial thumbnail (unencoded, unencrypted)
ActualThumbHash string `json:"actual_thumb_hash,omitempty"`
MimeType string `json:"mimetype,omitempty"`
CustomMeta string `json:"custom_meta,omitempty"`
EncryptedKey string `json:"encrypted_key,omitempty"`
IsFinal bool `json:"is_final,omitempty"` // current chunk is last or not
ChunkHash string `json:"chunk_hash"` // hash of current chunk
ChunkIndex int `json:"chunk_index,omitempty"` // the seq of current chunk. all chunks MUST be uploaded one by one because of streaming merkle hash
ChunkSize int64 `json:"chunk_size,omitempty"` // the size of a chunk. 64*1024 is default
UploadOffset int64 `json:"upload_offset,omitempty"` // It is next position that new incoming chunk should be append to
}
UploadFormData form data of upload
type UploadResult ¶
type WriteMarker ¶
type WriteMarker struct {
AllocationRoot string `gorm:"column:allocation_root;primary_key" json:"allocation_root"`
PreviousAllocationRoot string `gorm:"column:prev_allocation_root" json:"prev_allocation_root"`
AllocationID string `gorm:"column:allocation_id" json:"allocation_id"`
Size int64 `gorm:"column:size" json:"size"`
BlobberID string `gorm:"column:blobber_id" json:"blobber_id"`
Timestamp common.Timestamp `gorm:"column:timestamp" json:"timestamp"`
ClientID string `gorm:"column:client_id" json:"client_id"`
Signature string `gorm:"column:signature" json:"signature"`
}
Click to show internal directories.
Click to hide internal directories.