Documentation ¶
Index ¶
- type Cache
- type DiffNode
- type File
- func LoadPTPFile(filePath string) (*File, error)
- func NewFileFromMeta(dataDir, metaDir string, fileMeta *meta.FileMeta, ipfs ipfsapi.IIpfs, ...) (*File, error)
- func NewGroupFile(filePath string, writeAccessList []ethcommon.Address, groupAddress string, ...) (*File, error)
- func NewGroupFileFromMeta(fileMeta *meta.FileMeta, groupAddress string, groupName string, ...) (*File, error)
- func (f *File) Download(storage *Storage, ipfs ipfsapi.IIpfs)
- func (f *File) GrantWriteAccess(user, target ethcommon.Address) error
- func (f *File) RevokeWriteAccess(user, target ethcommon.Address) error
- func (f *File) SaveMetadata() error
- func (f *File) Update(fileMeta *meta.FileMeta, storage *Storage, ipfs ipfsapi.IIpfs) error
- func (f *File) UploadDiff(ipfs ipfsapi.IIpfs) (string, error)
- type GroupRepo
- func (repo *GroupRepo) CommitChanges(boxer tribecrypto.SymmetricKey) (string, error)
- func (repo *GroupRepo) Files() []*File
- func (repo *GroupRepo) Get(fileName string) *File
- func (repo *GroupRepo) IpfsHash() string
- func (repo *GroupRepo) IsValidChangeSet(newIpfsHash string, boxer tribecrypto.SymmetricKey, address ethcommon.Address) error
- func (repo *GroupRepo) Update(newIpfsHash string) error
- type IFile
- type Storage
- func (storage *Storage) CopyFileIntoGroupFiles(filePath, groupName string) error
- func (storage *Storage) CopyFileIntoMyFiles(filePath string) (string, error)
- func (storage *Storage) CopyFileIntoPublicDir(filePath string) error
- func (storage *Storage) DownloadAndDecryptWithFileBoxer(boxer tribecrypto.FileBoxer, ipfsHash string, ipfs ipfsapi.IIpfs) ([]byte, error)
- func (storage *Storage) DownloadAndDecryptWithSymmetricKey(boxer tribecrypto.SymmetricKey, ipfsHash string, ipfs ipfsapi.IIpfs) ([]byte, error)
- func (storage *Storage) DownloadTmpFile(ipfsHash string, ipfs ipfsapi.IIpfs) (string, error)
- func (storage *Storage) GetGroupFileMetas(groupAddress string) ([]*meta.FileMeta, error)
- func (storage *Storage) GetGroupMetas() ([]*meta.GroupMeta, error)
- func (storage *Storage) GroupFileDataDir(groupName string) string
- func (storage *Storage) GroupFileMetaDir(id string) string
- func (storage *Storage) GroupFileOrigDir(id string) string
- func (storage *Storage) GroupMetaDir() string
- func (storage *Storage) Init(username string)
- func (storage *Storage) LoadAccountData() ([]byte, error)
- func (storage *Storage) MakeGroupDir(name string, address string)
- func (storage *Storage) SaveAccountData(data []byte) error
- func (storage *Storage) SaveGroupMeta(groupMeta *meta.GroupMeta) error
- func (storage *Storage) UserFilesPath() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache currently not used
type DiffNode ¶
type DiffNode struct { Hash []byte Diff []diffmatchpatch.Diff Next string NextBoxer tribecrypto.FileBoxer }
DiffNode : Files are stored on IPFS as a linked list of diffs. DiffNode is a node in this list.
func DecodeDiffNode ¶
DecodeDiffNode decodes a DiffNode
type File ¶
type File struct { Meta *meta.FileMeta PendingChanges *meta.FileMeta DataPath string MetaPath string OrigPath string // contains filtered or unexported fields }
File represents a file that is shared in a peer to peer mode
func LoadPTPFile ¶
LoadPTPFile loads a File from the disk
func NewFileFromMeta ¶
func NewFileFromMeta(dataDir, metaDir string, fileMeta *meta.FileMeta, ipfs ipfsapi.IIpfs, storage *Storage) (*File, error)
NewFileFromMeta creates a new File instance from shared file meta data
func NewGroupFile ¶
func NewGroupFile(filePath string, writeAccessList []ethcommon.Address, groupAddress string, storage *Storage) (*File, error)
NewGroupFile creates a new file in the group's directory
func NewGroupFileFromMeta ¶
func NewGroupFileFromMeta(fileMeta *meta.FileMeta, groupAddress string, groupName string, storage *Storage) (*File, error)
NewGroupFileFromMeta creates a new File from the given group file meta data
func (*File) Download ¶
Download downloads all the necessary DiffNodes and patches the file along the way
func (*File) GrantWriteAccess ¶
GrantWriteAccess grants write access to a user
func (*File) RevokeWriteAccess ¶
RevokeWriteAccess revokes write access from a user
func (*File) SaveMetadata ¶
SaveMetadata saves FileMetaData to disk
type GroupRepo ¶
type GroupRepo struct {
// contains filtered or unexported fields
}
GroupRepo is responsible for managing and maintaining a group's file repository
func NewGroupRepo ¶
func NewGroupRepo(group interfaces.IGroup, user ethcommon.Address, storage *Storage, ipfs ipfs.IIpfs) (*GroupRepo, error)
NewGroupRepo creates a new GroupRepo
func (*GroupRepo) CommitChanges ¶
func (repo *GroupRepo) CommitChanges(boxer tribecrypto.SymmetricKey) (string, error)
CommitChanges encrypts and adds the repo's changes to IPFS
func (*GroupRepo) IsValidChangeSet ¶
func (repo *GroupRepo) IsValidChangeSet(newIpfsHash string, boxer tribecrypto.SymmetricKey, address ethcommon.Address) error
IsValidChangeSet verifies if a proposed change set is valid or not
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is a struct of the directory paths and has functions that are responsible for the file level functionalities
func (*Storage) CopyFileIntoGroupFiles ¶
CopyFileIntoGroupFiles copies a file to the group's directory
func (*Storage) CopyFileIntoMyFiles ¶
CopyFileIntoMyFiles copies a file to the user's private directory
func (*Storage) CopyFileIntoPublicDir ¶
CopyFileIntoPublicDir copies a file to the user's public directory
func (*Storage) DownloadAndDecryptWithFileBoxer ¶
func (storage *Storage) DownloadAndDecryptWithFileBoxer(boxer tribecrypto.FileBoxer, ipfsHash string, ipfs ipfsapi.IIpfs) ([]byte, error)
DownloadAndDecryptWithFileBoxer downloads a file from IPFS and decrypts its contents with a FileBoxer
func (*Storage) DownloadAndDecryptWithSymmetricKey ¶
func (storage *Storage) DownloadAndDecryptWithSymmetricKey(boxer tribecrypto.SymmetricKey, ipfsHash string, ipfs ipfsapi.IIpfs) ([]byte, error)
DownloadAndDecryptWithSymmetricKey downloads a file from IPFS and decrypts its contents with a symmetric key
func (*Storage) DownloadTmpFile ¶
DownloadTmpFile downloads a file from IPFS to a temporary directory
func (*Storage) GetGroupFileMetas ¶
GetGroupFileMetas loads all file metas belonging to the group
func (*Storage) GetGroupMetas ¶
GetGroupMetas loads all the locally stored group meta data from directory data/userdata/metas/GA/
func (*Storage) GroupFileDataDir ¶
GroupFileDataDir returns the directory in which the physical group files are stored
func (*Storage) GroupFileMetaDir ¶
GroupFileMetaDir returns the directory in which group file metas are stored
func (*Storage) GroupFileOrigDir ¶
GroupFileOrigDir ...
func (*Storage) GroupMetaDir ¶
GroupMetaDir returns the directory in which group metas are stored
func (*Storage) LoadAccountData ¶
LoadAccountData loads account data from the disk
func (*Storage) MakeGroupDir ¶
MakeGroupDir creates the directory structure needed by a group
func (*Storage) SaveAccountData ¶
SaveAccountData saves account data to disk
func (*Storage) SaveGroupMeta ¶
SaveGroupMeta saves a group meta to disk
func (*Storage) UserFilesPath ¶
UserFilesPath returns the path to the user's files