Documentation ¶
Index ¶
- func AddFile(data []byte) (string, error)
- func GetFile(cid string) ([]byte, error)
- func StorageAddFile(storageId uint32, fileName string, versionPtr *uint32, bufPtr *byte, ...) (error errno.Error)
- func StorageCapacity(storageId uint32, capacityPtr *byte) (error errno.Error)
- func StorageCapacitySize(storageId uint32, sizePtr *uint32) (error errno.Error)
- func StorageCid(cidPtr *byte, idPtr *uint32) (error errno.Error)
- func StorageCidSize(storageId uint32, fileName string, idPtr *uint32) (error errno.Error)
- func StorageCloseFile(storageId uint32, fd uint32) (error errno.Error)
- func StorageCurrentVersion(filename string, versionPtr *byte) (error errno.Error)
- func StorageCurrentVersionSize(storageId uint32, fileName string, sizePtr *uint32) (error errno.Error)
- func StorageDeleteFile(storageId uint32, fileName string, version uint32, all uint32) (error errno.Error)
- func StorageGet(storageName string, idPtr *uint32) (error errno.Error)
- func StorageGetFile(storageId uint32, fileName string, version uint32, fdPtr *uint32) (error errno.Error)
- func StorageIPFSAddFile(cid *byte, idPtr *uint32) (error errno.Error)
- func StorageIPFSAddFileSize(buf *byte, bufPtrLen uint32, idPtr *uint32) (error errno.Error)
- func StorageIpfsGetFile(cid string, bufPtr *byte) (error errno.Error)
- func StorageIpfsGetFileSize(cid string, sizePtr *uint32) (error errno.Error)
- func StorageListFiles(storageId uint32, bufPtr *byte) (error errno.Error)
- func StorageListFilesSize(storageId uint32, sizePtr *uint32) (error errno.Error)
- func StorageListVersions(storageId uint32, fileName string, versionPtr *byte) (error errno.Error)
- func StorageListVersionsSize(storageId uint32, fileName string, sizePtr *uint32) (error errno.Error)
- func StorageNew(storageName string, idPtr *uint32) (error errno.Error)
- func StorageReadFile(storageId uint32, fd uint32, buf *byte, bufSize uint32, count *uint32) (error errno.Error)
- func StorageUsed(storageId uint32, usedPtr *byte) (error errno.Error)
- func StorageUsedSize(storageId uint32, sizePtr *uint32) (error errno.Error)
- type DefaultFile
- type File
- func (f *File) Add(data []byte, overWrite bool) (int, error)
- func (f *File) CurrentVersion() (int, error)
- func (f *File) Delete() error
- func (f *File) DeleteAllVersions() error
- func (f *File) GetFile() (file *StorageFile, err error)
- func (f *File) Version(version uint32) *VersionedFile
- func (f *File) Versions() ([]string, error)
- type Storage
- type StorageFile
- type VersionedFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFile ¶ added in v0.1.20
AddFile chunks and adds content to the DAGService from an array of bytes. The content is stored as a UnixFS DAG (default for IPFS). It returns the cid of the file added.
func GetFile ¶ added in v0.1.20
GetFile returns the data of the given cid as an array of bytes. The file must have been added as a UnixFS DAG (default for IPFS).
func StorageAddFile ¶
func StorageCapacity ¶
func StorageCapacitySize ¶
func StorageCidSize ¶ added in v0.1.20
func StorageCurrentVersion ¶ added in v0.1.20
func StorageCurrentVersionSize ¶ added in v0.1.20
func StorageDeleteFile ¶
func StorageGetFile ¶
func StorageIPFSAddFile ¶ added in v0.1.20
func StorageIPFSAddFileSize ¶ added in v0.1.20
func StorageIpfsGetFile ¶ added in v0.1.20
func StorageIpfsGetFileSize ¶ added in v0.1.20
func StorageListFiles ¶ added in v0.1.20
func StorageListFilesSize ¶ added in v0.1.20
func StorageListVersions ¶
func StorageListVersionsSize ¶
func StorageReadFile ¶
Types ¶
type DefaultFile ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) Add ¶ added in v0.1.20
Add uses the data and overwrite given and adds the file to the storage. If overwrite is set to true then the current version number is not updated, and the data for the current version is updated. If overwrite is set to false, then for versioning enabled storages a new version is created For versioning disabled storages, file is only added if there is no file with the same name in the current storage. Returns the current version of the file.
func (*File) CurrentVersion ¶ added in v0.1.20
Current version looks up in the storage the latest version that is stored for that specific file. Returns the latest version for the file, if found, and an error.
func (*File) Delete ¶ added in v0.1.20
Delete uses the current file structure and the given version to delete the specific version of a file from the storage. Returns an error
func (*File) DeleteAllVersions ¶
DeleteAllVersions uses the current file and deletes all version of it in the storage. Returns an error
func (*File) GetFile ¶
func (f *File) GetFile() (file *StorageFile, err error)
GetFile grabs the the file from the storage Returns the file and an error
func (*File) Version ¶
func (f *File) Version(version uint32) *VersionedFile
Version uses current file and given versions to create a new instance of VersionedFile Returns the created VersionedFile structure.
type Storage ¶
type Storage uint32
func (Storage) Cid ¶ added in v0.1.20
Cid looks up the given filename in the given storage. Returns the cid corresponding to the file if found and an error.
func (Storage) File ¶
File uses the name passed in and creates a new instance of File that holds the storage and filename. Returns the File structure.
func (Storage) ListFiles ¶ added in v0.1.20
ListFiles looks up all saved files in the given storage. Returns an array of all Files found in the storage and an error.
func (Storage) RemainingCapacity ¶
Remaining capacity loops through to given storage and calculates how much space left is available. Returns the remaining space available and an error.
type StorageFile ¶
type StorageFile struct {
// contains filtered or unexported fields
}
func (*StorageFile) Close ¶
func (file *StorageFile) Close() error
Close closes the current file Returns an error
type VersionedFile ¶
type VersionedFile struct {
DefaultFile
}