pufs_client

package
v0.0.0-...-02f8797 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileEditor

func FileEditor(data []byte, client IpfsClient, fileName string, w fyne.Window) *fyne.Container

By the nature of the IPFS system, IPFS hashes are immutable. Thus, in order for us to peoperly "update" a file, we must first delete the file then re-add the file.

func FileMetadata

func FileMetadata(fileData FileData)

Create fyne table, insert file data within.

Types

type Empty

type Empty struct{}

type FileData

type FileData struct {
	FileName   string
	FileSize   int64
	IpfsHash   string
	UploadedAt string
}

type IpfsClient

type IpfsClient struct {
	Id                int64
	Client            pufs_pb.IpfsFileSystemClient
	Files             []string
	FileUpload        chan string
	DeletedFile       chan string
	FileDeleted       chan bool
	FileUploadedInApp chan bool
	Settings          *settings.Settings

	InvalidFileTypes []string
	FileMetadata     map[string]FileData
	// contains filtered or unexported fields
}

Note: FileUploadedInApp Denotes if the file was uploaded in the application. If so, skip the reload when server sends back the ACK that a file was uploaded

func (*IpfsClient) ChunkFile

func (c *IpfsClient) ChunkFile(fileName string) bool

func (*IpfsClient) DeleteFile

func (c *IpfsClient) DeleteFile(fileName string, showMessage bool) error

func (*IpfsClient) DeleteFileMetadata

func (c *IpfsClient) DeleteFileMetadata(fileName string)

func (*IpfsClient) Download

func (c *IpfsClient) Download(fileName string) error

func (*IpfsClient) DownloadCappedFile

func (c *IpfsClient) DownloadCappedFile(fileName, path string) error

func (*IpfsClient) DownloadFile

func (c *IpfsClient) DownloadFile(fileName, path string) error

We must chunk the file here if its over the 4MB limit.

func (*IpfsClient) DownloadedFileContent

func (c *IpfsClient) DownloadedFileContent(fileName string) (*[]byte, error)

Returns byte array of file content. Uses the file path for downloaded files. Validates a given file is found with that name. (Note: this should be calld after "Download" has ran successfully)

func (*IpfsClient) GetFileMetadata

func (c *IpfsClient) GetFileMetadata(fileName string) *FileData

func (*IpfsClient) LoadFiles

func (c *IpfsClient) LoadFiles()

Load files upon client start.

func (*IpfsClient) SaveFileMetadata

func (c *IpfsClient) SaveFileMetadata(data FileData)

func (*IpfsClient) SubscribeFileStream

func (c *IpfsClient) SubscribeFileStream()

Listen for file changes realtime. Take ID and store this upstream.

func (*IpfsClient) UnsubscribeClient

func (c *IpfsClient) UnsubscribeClient()

func (*IpfsClient) UploadFile

func (c *IpfsClient) UploadFile(path, fileName string) error

func (*IpfsClient) UploadFileData

func (c *IpfsClient) UploadFileData(fileData []byte, fileSize int64, fileName string) error

Uploads a file stream that is under the 4MB gRPC file size cap

func (*IpfsClient) UploadFileStream

func (c *IpfsClient) UploadFileStream(fileData *os.File, fileSize int64, fileName string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL