user

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package user provides the client platform for user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	User *tpUser.User
	PWD  string

	QueryCache map[string]*tpUser.User
	*p2p.UserNode
	*lib.ClientFramework
	// contains filtered or unexported fields
}

Client provides the platform for user storing files in P2P network.

func NewUserClient

func NewUserClient(name, keyFile string, bootstrapAddrs []ma.Multiaddr) (*Client, error)

NewUserClient is the construct for User's Client.

func (*Client) ChangePWD

func (c *Client) ChangePWD(dst string) error

ChangePWD changed the PWD to destination path.

func (*Client) CreateDirectory

func (c *Client) CreateDirectory(p string) error

CreateDirectory create new directory of the path and send transaction.

func (*Client) CreateDirectoryWithFiles

func (c *Client) CreateDirectoryWithFiles(src, dst string, dataShards, parShards int) error

CreateDirectoryWithFiles upload directory and files in it from source path in system to destination path.

func (*Client) CreateFile

func (c *Client) CreateFile(src, dst string, dataShards, parShards int) error

CreateFile create new file of the source. After sending transaction, upload file into P2P network.

func (*Client) DeleteDirectory

func (c *Client) DeleteDirectory(p string) error

DeleteDirectory delete directory of the path in 'home' directory and files under it. After delete it, send transaction.

func (*Client) DeleteFile

func (c *Client) DeleteFile(p string) error

DeleteFile delete the target file, then send transaction.

func (*Client) DownloadFiles

func (c *Client) DownloadFiles(p, dst string)

DownloadFiles download the file or directory to destination path in system.

func (*Client) DownloadSharedFiles

func (c *Client) DownloadSharedFiles(p, dst, ownerAddr, ownerPub string)

DownloadSharedFiles download the file or directory in 'shared' directory of owner to destination path in system.

func (*Client) GetINode

func (c *Client) GetINode(p string) (tpStorage.INode, error)

GetINode returns the iNode of the path in 'home' directory. If error is not nil, it will return.

func (*Client) GetOtherSharedINode

func (c *Client) GetOtherSharedINode(owner, p string) (tpStorage.INode, error)

GetOtherSharedINode returns the iNode of user's shared files. If error is not nil, it will return.

func (*Client) GetSharedINode

func (c *Client) GetSharedINode(p string) (tpStorage.INode, error)

GetSharedINode returns the iNode of the path in 'shared' directory. If error is not nil, it will return./

func (*Client) GetSize

func (c *Client) GetSize() int64

GetSize returns the total size of files stored in P2P network.

func (*Client) ListDirectory

func (c *Client) ListDirectory(p string) ([]tpStorage.INodeInfo, error)

ListDirectory returns the information of iNodes in the path of 'home' directory.

func (*Client) ListOtherSharedDirectory

func (c *Client) ListOtherSharedDirectory(owner, p string) ([]tpStorage.INodeInfo, error)

ListOtherSharedDirectory returns the list of user's shared directory. If error is not nil, it will return.

func (*Client) ListSharedDirectory

func (c *Client) ListSharedDirectory(p string) ([]tpStorage.INodeInfo, error)

ListSharedDirectory returns the information of iNodes in the path of 'shared' directory.

func (*Client) ListUsersShared

func (c *Client) ListUsersShared(other bool) error

ListUsersShared get the query cache for list shared files.

func (*Client) Move

func (c *Client) Move(src, dst string) error

Move change the iNode's parent path from source to destination.

func (*Client) PublishKey

func (c *Client) PublishKey(p string) error

PublishKey publish keys of the files in the path.

func (*Client) Rename

func (c *Client) Rename(src, newName string) error

Rename change the target name to new name.

func (*Client) ShareFiles

func (c *Client) ShareFiles(src, dst string) ([]string, error)

ShareFiles share the files from 'home' directory to 'shared' directory.

func (*Client) Sync

func (c *Client) Sync() error

Sync get user's data from blockchain.

func (*Client) UserRegister

func (c *Client) UserRegister() error

UserRegister register user in the blockchain.

Jump to

Keyboard shortcuts

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