Documentation
¶
Index ¶
- Variables
- func Decompress(dataToDecompress []byte, compression string, blockSize uint32) ([]byte, error)
- type BlockInfo
- type Blocks
- type Entry
- type File
- func (f *File) AddToFileMap(filePath string, meta *MetaData)
- func (f *File) BackupFromFileName(fileNameWithPath, podPassword string) (*MetaData, error)
- func (f *File) Download(podFileWithPath, podPassword string) (io.ReadCloser, uint64, error)
- func (f *File) GetFromFileMap(filePath string) *MetaData
- func (f *File) GetMetaFromFileName(fileNameWithPath, podPassword string, userAddress utils.Address) (*MetaData, error)
- func (f *File) GetStats(podName, podFileWithPath, podPassword string) (*Stats, error)
- func (f *File) IsFileAlreadyPresent(fileWithPath string) bool
- func (f *File) ListFiles(files []string, podPassword string) ([]Entry, error)
- func (f *File) LoadFileMeta(fileNameWithPath, podPassword string) error
- func (f *File) OpenFileForIndex(podFile, podPassword string) (*Reader, error)
- func (f *File) PutMetaForFile(meta *MetaData, podPassword string) error
- func (f *File) ReadSeeker(podFileWithPath, podPassword string) (io.ReadSeekCloser, uint64, error)
- func (f *File) RemoveAllFromFileMap()
- func (f *File) RemoveFromFileMap(filePath string)
- func (f *File) RenameFromFileName(fileNameWithPath, newFileNameWithPath, podPassword string) (*MetaData, error)
- func (f *File) RmFile(podFileWithPath, podPassword string) error
- func (f *File) Upload(fd io.Reader, podFileName string, fileSize int64, blockSize uint32, ...) error
- func (f *File) WriteAt(podFileWithPath, podPassword string, update io.Reader, offset uint64, ...) (int, error)
- type IFile
- type INode
- type MetaData
- type Reader
- type Stats
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFileNotPresent denotes file is not present ErrFileNotPresent = errors.New("file not present") // ErrFileAlreadyPresent denotes file is present ErrFileAlreadyPresent = errors.New("file already present in the destination dir") // ErrFileNotFound denotes file is not found in dfs ErrFileNotFound = errors.New("file not found in dfs") )
var ( MetaVersion uint8 = 2 ErrDeletedFeed = errors.New("deleted feed") )
var (
ErrGzipBlSize = fmt.Errorf("gzip: block size cannot be less than %d", minBlockSizeForGzip)
)
var (
ErrInvalidOffset = errors.New("invalid offset")
)
Functions ¶
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents a file in a pod
func NewFile ¶
func NewFile(podName string, client blockstore.Client, fd *feed.API, user utils.Address, m taskmanager.TaskManagerGO, logger logging.Logger) *File
NewFile creates the base file object which has all the methods related to file manipulation.
func (*File) AddToFileMap ¶
AddToFileMap adds a file metadata into fileMap
func (*File) BackupFromFileName ¶ added in v0.7.0
func (*File) Download ¶
Download does all the validation for the existence of the file and creates a Reader to read the contents of the file from the pod.
func (*File) GetFromFileMap ¶
GetFromFileMap gets file metadata from the fileMap
func (*File) GetMetaFromFileName ¶ added in v0.5.3
func (*File) GetStats ¶ added in v0.5.3
GetStats given a filename this function returns all the information about the file including the block information.
func (*File) IsFileAlreadyPresent ¶ added in v0.5.3
IsFileAlreadyPresent checks if a file is present in the fileMap
func (*File) ListFiles ¶
ListFiles given a list of files, list files gives back the information related to each file.
func (*File) LoadFileMeta ¶
LoadFileMeta is used in syncing
func (*File) OpenFileForIndex ¶
OpenFileForIndex opens file for indexing for document db from pod filepath TODO test skipcq: TCV-001
func (*File) PutMetaForFile ¶ added in v0.6.2
func (*File) ReadSeeker ¶ added in v0.9.1
ReadSeeker does all the validation for the existence of the file and creates a ReadSeekCloser to read the contents of the file from the pod.
func (*File) RemoveAllFromFileMap ¶ added in v0.5.3
func (f *File) RemoveAllFromFileMap()
RemoveAllFromFileMap resets the fileMap
func (*File) RemoveFromFileMap ¶
RemoveFromFileMap removes a file metadata from fileMap
func (*File) RenameFromFileName ¶ added in v0.9.1
func (*File) RmFile ¶ added in v0.5.3
RmFile deletes all the blocks of a file, and it related metadata from the Swarm network.
func (*File) Upload ¶
func (f *File) Upload(fd io.Reader, podFileName string, fileSize int64, blockSize uint32, podPath, compression, podPassword string) error
Upload uploads a given blob of bytes as a file in the pod. It also splits the file into number of blocks. the size of the block is provided during upload. This function also does compression of the blocks gzip/snappy if it is requested during the upload.
type IFile ¶ added in v0.5.3
type IFile interface { Upload(fd io.Reader, podFileName string, fileSize int64, blockSize uint32, podPath, compression, podPassword string) error Download(podFileWithPath, podPassword string) (io.ReadCloser, uint64, error) ListFiles(files []string, podPassword string) ([]Entry, error) GetStats(podName, podFileWithPath, podPassword string) (*Stats, error) RmFile(podFileWithPath, podPassword string) error LoadFileMeta(fileNameWithPath, podPassword string) error }
type MetaData ¶ added in v0.5.3
type MetaData struct { Version uint8 `json:"version"` Path string `json:"filePath"` Name string `json:"fileName"` Size uint64 `json:"fileSize"` BlockSize uint32 `json:"blockSize"` ContentType string `json:"contentType"` Compression string `json:"compression"` CreationTime int64 `json:"creationTime"` AccessTime int64 `json:"accessTime"` ModificationTime int64 `json:"modificationTime"` InodeAddress []byte `json:"fileInodeReference"` }
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func NewReader ¶
func NewReader(fileInode INode, client blockstore.Client, fileSize uint64, blockSize uint32, compression, encryptionPassword string, cache bool) *Reader
NewReader create a new reader object to read a file from the pod based on its configuration.
type Stats ¶ added in v0.5.3
type Stats struct { PodName string `json:"podName"` FilePath string `json:"filePath"` FileName string `json:"fileName"` FileSize string `json:"fileSize"` BlockSize string `json:"blockSize"` Compression string `json:"compression"` ContentType string `json:"contentType"` CreationTime string `json:"creationTime"` ModificationTime string `json:"modificationTime"` AccessTime string `json:"accessTime"` Blocks []Blocks `json:"blocks"` }