dfs

package
v0.10.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2023 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserNotLoggedIn indicate the user is not logged-in
	ErrUserNotLoggedIn = errors.New("user not logged-in")
	// ErrPodNotOpen indicates pod is not open
	ErrPodNotOpen = errors.New("pod not open")
	// ErrFileNotPresent indicates file is not present
	ErrFileNotPresent = errors.New("file not present")
	// ErrFileAlreadyPresent indicates file is already present
	ErrFileAlreadyPresent = errors.New("file already exist with new name")
)

Functions

This section is empty.

Types

type API added in v0.9.1

type API struct {
	io.Closer
	// contains filtered or unexported fields
}

API is the go api for fairOS

func NewDfsAPI

func NewDfsAPI(ctx context.Context, opts *Options) (*API, error)

NewDfsAPI is the main entry point for the df controller.

func NewMockDfsAPI added in v0.9.1

func NewMockDfsAPI(client blockstore.Client, users *user.Users, logger logging.Logger) *API

NewMockDfsAPI is used for tests only

func (*API) ApproveSubscription added in v0.9.3

func (a *API) ApproveSubscription(sessionId, podName string, reqHash, nameHash [32]byte) error

ApproveSubscription approves a subscription to a pod

func (*API) ChangePodListStatusInMarketplace added in v0.9.3

func (a *API) ChangePodListStatusInMarketplace(sessionId string, subHash [32]byte, show bool) error

ChangePodListStatusInMarketplace changes the status of a pod in the datahub marketplace

func (*API) ChmodDir added in v0.9.2

func (a *API) ChmodDir(podName, directoryNameWithPath, sessionId string, mode uint32) error

ChmodDir is a controller function which validates if the user is logged-in, pod is open and calls changes mode of a directory

func (*API) ChmodFile added in v0.9.2

func (a *API) ChmodFile(podName, podFileWithPath, sessionId string, mode uint32) error

ChmodFile is a controller function which validates if the user is logged-in, pod is open and calls changes mode of a file

func (*API) Close added in v0.9.1

func (a *API) Close() error

Close stops the taskmanager

func (*API) ClosePod added in v0.9.1

func (a *API) ClosePod(podName, sessionId string) error

ClosePod closes a pod

func (*API) ConnectPortableAccountWithWallet added in v0.9.3

func (a *API) ConnectPortableAccountWithWallet(userName, passPhrase, addressHex, signature string) error

ConnectPortableAccountWithWallet is a controller function which calls the users login function.

func (*API) CreatePod added in v0.9.1

func (a *API) CreatePod(podName, sessionId string) (*pod.Info, error)

CreatePod creates a new pod

func (*API) CreateUserV2 added in v0.9.1

func (a *API) CreateUserV2(userName, passPhrase, mnemonic, sessionId string) (*user.SignupResponse, error)

CreateUserV2 is a controller function which calls the create user function from the user object.

func (*API) DecryptAndOpenSubscriptionPod added in v0.9.3

func (a *API) DecryptAndOpenSubscriptionPod(sessionId, reference string, sellerNameHash [32]byte) (*pod.Info, error)

DecryptAndOpenSubscriptionPod decrypts pod info and opens the subscription pod

func (*API) DeleteFile added in v0.9.1

func (a *API) DeleteFile(podName, podFileWithPath, sessionId string) error

DeleteFile is a controller function which validates if the user is logged-in, pod is open and delete the file. It also removes the file entry from the parent directory.

func (*API) DeletePod added in v0.9.1

func (a *API) DeletePod(podName, sessionId string) error

DeletePod deletes a pod

func (*API) DeleteUserV2 added in v0.9.1

func (a *API) DeleteUserV2(passPhrase, sessionId string) error

DeleteUserV2 is a controller function which deletes a logged-in user.

func (*API) DirectoryInode added in v0.9.1

func (a *API) DirectoryInode(podName, directoryName, sessionId string) (*dir.Inode, error)

DirectoryInode is a controller function which validates if the user is logged-in, pod is open and calls the dir object to get the inode info about the given directory.

func (*API) DirectoryStat added in v0.9.1

func (a *API) DirectoryStat(podName, directoryPath, sessionId string) (*dir.Stats, error)

DirectoryStat is a controller function which validates if the user is logged-in, pod is open and calls the dir object to get the information about the given directory.

func (*API) DocBatch added in v0.9.1

func (a *API) DocBatch(sessionId, podName, name string) (*collection.DocBatch, error)

DocBatch initiates a batch inserting session.

func (*API) DocBatchPut added in v0.9.1

func (a *API) DocBatchPut(sessionId, podName string, doc []byte, docBatch *collection.DocBatch) error

DocBatchPut inserts records in to a document batch.

func (*API) DocBatchWrite added in v0.9.1

func (a *API) DocBatchWrite(sessionId, podName string, docBatch *collection.DocBatch) error

DocBatchWrite commits the batch document insert.

func (*API) DocCount added in v0.9.1

func (a *API) DocCount(sessionId, podName, name, expr string) (*collection.TableKeyCount, error)

DocCount is a controller function which does all the checks before counting all the documents ina documentDB.

func (*API) DocCreate added in v0.9.1

func (a *API) DocCreate(sessionId, podName, name string, indexes map[string]collection.IndexType, mutable bool) error

DocCreate is a controller function which does all the checks before creating a documentDB.

func (*API) DocDel added in v0.9.1

func (a *API) DocDel(sessionId, podName, name, id string) error

DocDel is a controller function which does all the checks before deleting a documentDB.

func (*API) DocDelete added in v0.9.1

func (a *API) DocDelete(sessionId, podName, name string) error

DocDelete is a controller function which does all the checks before deleting a documentDB.

func (*API) DocFind added in v0.9.1

func (a *API) DocFind(sessionId, podName, name, expr string, limit int) ([][]byte, error)

DocFind is a controller function which does all the checks before finding records from a documentDB.

func (*API) DocGet added in v0.9.1

func (a *API) DocGet(sessionId, podName, name, id string) ([]byte, error)

DocGet is a controller function which does all the checks before retrieving // a document in the documentDB.

func (*API) DocIndexJson added in v0.9.1

func (a *API) DocIndexJson(sessionId, podName, name, podFileWithPath string) error

DocIndexJson indexes a json files in to the document DB.

func (*API) DocList added in v0.9.1

func (a *API) DocList(sessionId, podName string) (map[string]collection.DBSchema, error)

DocList is a controller function which does all the checks before listing all the documentDB available in the pod.

func (*API) DocOpen added in v0.9.1

func (a *API) DocOpen(sessionId, podName, name string) error

DocOpen is a controller function which does all the checks before opening a documentDB.

func (*API) DocPut added in v0.9.1

func (a *API) DocPut(sessionId, podName, name string, value []byte) error

DocPut is a controller function which does all the checks before inserting a document in the documentDB.

func (*API) DownloadFile added in v0.9.1

func (a *API) DownloadFile(podName, podFileWithPath, sessionId string) (io.ReadCloser, uint64, error)

DownloadFile is a controller function which validates if the user is logged-in, pod is open and calls the download function.

func (*API) EncryptSubscription added in v0.9.3

func (a *API) EncryptSubscription(sessionId, podName string, nameHash [32]byte) (string, error)

EncryptSubscription encrypts the subscription information

func (*API) FileStat added in v0.9.1

func (a *API) FileStat(podName, podFileWithPath, sessionId string) (*f.Stats, error)

FileStat is a controller function which validates if the user is logged-in, pod is open and gets the information about the file.

func (*API) ForkPod added in v0.9.2

func (a *API) ForkPod(podName, forkName, sessionId string) error

ForkPod forks a pod

func (*API) ForkPodFromRef added in v0.9.2

func (a *API) ForkPodFromRef(forkName, refString, sessionId string) error

ForkPodFromRef forks a pod from a sharing reference

func (*API) GetNameHash added in v0.9.3

func (a *API) GetNameHash(sessionId, username string) ([32]byte, error)

GetNameHash returns the nameHash of the username

func (*API) GetSubsRequests added in v0.9.3

func (a *API) GetSubsRequests(sessionId string) ([]datahub.DataHubSubRequest, error)

GetSubsRequests returns the list of subscription requests

func (*API) GetSubscribablePodInfo added in v0.9.3

func (a *API) GetSubscribablePodInfo(sessionId string, subHash [32]byte) (*rpc.SubscriptionItemInfo, error)

GetSubscribablePodInfo returns the subscribable pod info

func (*API) GetSubscribablePods added in v0.9.3

func (a *API) GetSubscribablePods(sessionId string) ([]datahub.DataHubSub, error)

GetSubscribablePods returns the list of subscribable pods

func (*API) GetSubscriptions added in v0.9.3

func (a *API) GetSubscriptions(sessionId string) ([]SubscriptionInfo, error)

GetSubscriptions returns the list of subscriptions

func (*API) GetUserStat added in v0.9.1

func (a *API) GetUserStat(sessionId string) (*user.Stat, error)

GetUserStat gets the information related to the user.

func (*API) IsDBOpened added in v0.10.0

func (a *API) IsDBOpened(sessionId, podName, name string) (bool, error)

IsDBOpened is a controller function which checks if documentDB is open

func (*API) IsDirPresent added in v0.9.1

func (a *API) IsDirPresent(podName, directoryNameWithPath, sessionId string) (bool, error)

IsDirPresent is a controller function which validates if the user is logged-in, pod is open and calls the dir object to check if the directory is present.

func (*API) IsPodExist added in v0.9.1

func (a *API) IsPodExist(podName, sessionId string) bool

IsPodExist checks if a pod exists

func (*API) IsUserLoggedIn added in v0.9.1

func (a *API) IsUserLoggedIn(userName string) bool

IsUserLoggedIn checks if the given user is logged-in

func (*API) IsUserNameAvailableV2 added in v0.9.1

func (a *API) IsUserNameAvailableV2(userName string) bool

IsUserNameAvailableV2 checks if a given username is available in this dfs server.

func (*API) KVBatch added in v0.9.1

func (a *API) KVBatch(sessionId, podName, name string, columns []string) (*collection.Batch, error)

KVBatch does validation checks and calls the batch KVtable function.

func (*API) KVBatchPut added in v0.9.1

func (a *API) KVBatchPut(sessionId, podName, key string, value []byte, batch *collection.Batch) error

KVBatchPut does validation checks and calls the batch put KVtable function.

func (*API) KVBatchWrite added in v0.9.1

func (a *API) KVBatchWrite(sessionId, podName string, batch *collection.Batch) error

KVBatchWrite does validation checks and calls the batch write KVtable function.

func (*API) KVCount added in v0.9.1

func (a *API) KVCount(sessionId, podName, name string) (*collection.TableKeyCount, error)

KVCount does validation checks and calls the count KVtable function.

func (*API) KVCreate added in v0.9.1

func (a *API) KVCreate(sessionId, podName, name string, indexType collection.IndexType) error

KVCreate does validation checks and calls the create KVtable function.

func (*API) KVDel added in v0.9.1

func (a *API) KVDel(sessionId, podName, name, key string) ([]byte, error)

KVDel does validation checks and calls the delete KVtable function.

func (*API) KVDelete added in v0.9.1

func (a *API) KVDelete(sessionId, podName, name string) error

KVDelete does validation checks and calls the delete KVtable function.

func (*API) KVGet added in v0.9.1

func (a *API) KVGet(sessionId, podName, name, key string) ([]string, []byte, error)

KVGet does validation checks and calls the get KVtable function.

func (*API) KVGetNext added in v0.9.1

func (a *API) KVGetNext(sessionId, podName, name string) ([]string, string, []byte, error)

KVGetNext does validation checks and calls the get next KVtable function.

func (*API) KVList added in v0.9.1

func (a *API) KVList(sessionId, podName string) (map[string][]string, error)

KVList does validation checks and calls the list KVtable function.

func (*API) KVOpen added in v0.9.1

func (a *API) KVOpen(sessionId, podName, name string) error

KVOpen does validation checks and calls the open KVtable function.

func (*API) KVPut added in v0.9.1

func (a *API) KVPut(sessionId, podName, name, key string, value []byte) error

KVPut does validation checks and calls the put KVtable function.

func (*API) KVSeek added in v0.9.1

func (a *API) KVSeek(sessionId, podName, name, start, end string, limit int64) (*collection.Iterator, error)

KVSeek does validation checks and calls the seek KVtable function.

func (*API) ListDir added in v0.9.1

func (a *API) ListDir(podName, currentDir, sessionId string) ([]dir.Entry, []f.Entry, error)

ListDir is a controller function which validates if the user is logged-in, pod is open and calls the dir object to list the contents of the supplied directory.

func (*API) ListPodInMarketplace added in v0.9.3

func (a *API) ListPodInMarketplace(sessionId, podName, title, desc, thumbnail string, price uint64, daysValid uint16, category [32]byte) error

ListPodInMarketplace lists a pod in the datahub marketplace

func (*API) ListPods added in v0.9.1

func (a *API) ListPods(sessionId string) ([]string, []string, error)

ListPods lists all the pods of a user

func (*API) LoadLiteUser added in v0.9.2

func (a *API) LoadLiteUser(userName, passPhrase, mnemonic, sessionId string) (string, string, *user.Info, error)

LoadLiteUser is a controller function which loads user from mnemonic and doesn't store any user info on chain

func (*API) LoginUserV2 added in v0.9.1

func (a *API) LoginUserV2(userName, passPhrase, sessionId string) (*user.LoginResponse, error)

LoginUserV2 is a controller function which calls the users login function.

func (*API) LoginWithWallet added in v0.9.3

func (a *API) LoginWithWallet(addressHex, signature, sessionId string) (*user.Info, string, error)

LoginWithWallet is a controller function which calls the users login function.

func (*API) LogoutUser added in v0.9.1

func (a *API) LogoutUser(sessionId string) error

LogoutUser is a controller function which gets the logged-in user information and logs it out.

func (*API) Mkdir added in v0.9.1

func (a *API) Mkdir(podName, dirToCreateWithPath, sessionId string, mode uint32) error

Mkdir is a controller function which validates if the user is logged-in, pod is open and calls the make directory function in the dir object.

func (*API) OpenPod added in v0.9.1

func (a *API) OpenPod(podName, sessionId string) (*pod.Info, error)

OpenPod opens a pod

func (*API) OpenSubscribedPod added in v0.9.3

func (a *API) OpenSubscribedPod(sessionId string, subHash [32]byte, infoLocation string) (*pod.Info, error)

OpenSubscribedPod opens the subscribed pod

func (*API) PodList added in v0.9.1

func (a *API) PodList(sessionId string) (*pod.List, error)

PodList lists all available pods in json format

func (*API) PodReceive added in v0.9.1

func (a *API) PodReceive(sessionId, sharedPodName string, ref utils.Reference) (*pod.Info, error)

PodReceive - receive a pod from a sharingReference

func (*API) PodReceiveInfo added in v0.9.1

func (a *API) PodReceiveInfo(sessionId string, ref utils.Reference) (*pod.ShareInfo, error)

PodReceiveInfo receives the pod information

func (*API) PodShare added in v0.9.1

func (a *API) PodShare(podName, sharedPodName, sessionId string) (string, error)

PodShare shares a pod

func (*API) PodStat added in v0.9.1

func (a *API) PodStat(podName, sessionId string) (*pod.Stat, error)

PodStat returns the pod stat

func (*API) PublicPodDisLs added in v0.9.3

func (a *API) PublicPodDisLs(pod *pod.ShareInfo, dirPathToLs string) ([]dir.Entry, []file.Entry, error)

PublicPodDisLs lists a directory from a public pod

func (*API) PublicPodFileDownload added in v0.9.3

func (a *API) PublicPodFileDownload(pod *pod.ShareInfo, filePath string) (io.ReadCloser, uint64, error)

PublicPodFileDownload downloads a file from a public pod

func (*API) PublicPodKVEntryGet added in v0.9.3

func (a *API) PublicPodKVEntryGet(pod *pod.ShareInfo, name, key string) ([]string, []byte, error)

PublicPodKVEntryGet gets a kv entry from a public pod

func (*API) PublicPodKVGetter added in v0.10.0

func (a *API) PublicPodKVGetter(pod *pod.ShareInfo) KVGetter

PublicPodKVGetter gets a kv store getter interface

func (*API) PublicPodReceiveInfo added in v0.9.3

func (a *API) PublicPodReceiveInfo(ref utils.Reference) (*pod.ShareInfo, error)

PublicPodReceiveInfo receives the pod information for a public pod

func (*API) ReadSeekCloser added in v0.9.1

func (a *API) ReadSeekCloser(podName, podFileWithPath, sessionId string) (io.ReadSeekCloser, uint64, error)

ReadSeekCloser is a controller function which validates if the user is logged-in, pod is open and calls the download function.

func (*API) ReceiveFile added in v0.9.1

func (a *API) ReceiveFile(podName, sessionId, ref, dir string) (string, error)

ReceiveFile is a controller function which validates if the user is logged-in, pod is open and calls the ReceiveFile function to get the shared file in to the given pod.

func (*API) ReceiveInfo added in v0.9.1

func (a *API) ReceiveInfo(sessionId, ref string) (*user.ReceiveFileInfo, error)

ReceiveInfo is a controller function which validates if the user is logged-in, calls the ReceiveInfo function to display the shared file's information.

func (*API) RenameDir added in v0.9.1

func (a *API) RenameDir(podName, dirToRenameWithPath, newName, sessionId string) error

RenameDir is a controller function which validates if the user is logged-in, pod is open and calls the rename directory function in the dir object.

func (*API) RenameFile added in v0.9.1

func (a *API) RenameFile(podName, fileNameWithPath, newFileNameWithPath, sessionId string) error

RenameFile is a controller function which validates if the user is logged-in,

pod is open and calls renaming of a file

func (*API) RequestSubscription added in v0.9.3

func (a *API) RequestSubscription(sessionId string, subHash [32]byte) error

RequestSubscription requests a subscription to a pod

func (*API) RmDir added in v0.9.1

func (a *API) RmDir(podName, directoryNameWithPath, sessionId string) error

RmDir is a controller function which validates if the user is logged-in, pod is open and calls the dir object to remove the supplied directory.

func (*API) ShareFile added in v0.9.1

func (a *API) ShareFile(podName, podFileWithPath, destinationUser, sessionId string) (string, error)

ShareFile is a controller function which validates if the user is logged-in, pod is open and calls the shareFile function.

func (*API) StatusFile added in v0.9.2

func (a *API) StatusFile(podName, podFileWithPath, sessionId string) (int64, int64, int64, error)

StatusFile is a controller function which validates if the user is logged-in, pod is open and calls the sync status of file function.

func (*API) SyncPod added in v0.9.1

func (a *API) SyncPod(podName, sessionId string) error

SyncPod syncs a pod

func (*API) SyncPodAsync added in v0.9.2

func (a *API) SyncPodAsync(ctx context.Context, podName, sessionId string) error

SyncPodAsync syncs a pod asynchronously

func (*API) UploadFile added in v0.9.1

func (a *API) UploadFile(podName, podFileName, sessionId string, fileSize int64, fd io.Reader, podPath, compression string, blockSize, mode uint32, overwrite bool) error

UploadFile is a controller function which validates if the user is logged-in,

pod is open and calls the upload function.

func (*API) WriteAtFile added in v0.9.1

func (a *API) WriteAtFile(podName, fileNameWithPath, sessionId string, update io.Reader, offset uint64, truncate bool) (int, error)

WriteAtFile is a controller function which writes a file from a given offset

pod is open and calls writeAt of a file

type KVGetter added in v0.10.0

type KVGetter interface {
	KVGet(name, key string) ([]string, []byte, error)
	OpenKVTable(name, encryptionPassword string) error
}

type Options added in v0.10.0

type Options struct {
	BeeApiEndpoint     string
	Stamp              string
	EnsConfig          *contracts.ENSConfig
	SubscriptionConfig *contracts.SubscriptionConfig
	Logger             logging.Logger
}

type SubscriptionInfo added in v0.9.3

type SubscriptionInfo struct {
	SubHash      [32]byte
	PodName      string
	PodAddress   string
	Category     string
	InfoLocation []byte
	ValidTill    int64
}

SubscriptionInfo contains the subscription information

Jump to

Keyboard shortcuts

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