Documentation ¶
Index ¶
- Constants
- Variables
- func CleanPodName(podName string) (string, error)
- type DirSnapShot
- type Group
- func (g *Group) AcceptGroupInvite(ref []byte) error
- func (g *Group) AddMember(groupName string, memberAddress common.Address, ...) ([]byte, error)
- func (g *Group) CloseGroup(podName string) error
- func (g *Group) CreateGroup(name string) (*Info, error)
- func (g *Group) GetGroupInfoFromMap(name string) (*Info, string, error)
- func (g *Group) GetGroupMembers(groupName string) (map[string]uint8, error)
- func (g *Group) GetPermission(groupName string) (uint8, error)
- func (g *Group) ListGroup() (*GroupList, error)
- func (g *Group) OpenGroup(name string) (*Info, error)
- func (g *Group) RemoveGroup(groupName string) error
- func (g *Group) RemoveMember(groupName string, memberAddress common.Address) error
- func (g *Group) RemoveSharedGroup(groupName string) error
- func (g *Group) UpdatePermission(groupName string, memberAddress common.Address, permission uint8) error
- type GroupItem
- type GroupList
- type Info
- func (i *Info) GetAccountInfo() *account.Info
- func (i *Info) GetDirectory() *di.Directory
- func (i *Info) GetDocStore() *collection.Document
- func (i *Info) GetFeed() *feed.API
- func (i *Info) GetFile() *f.File
- func (i *Info) GetKVStore() *collection.KeyValue
- func (i *Info) GetPodAddress() utils.Address
- func (i *Info) GetPodName() string
- func (i *Info) GetPodPassword() string
- type List
- type ListItem
- type Pod
- func (p *Pod) ApproveSubscription(podName string, requestHash [32]byte, subscriberPublicKey *ecdsa.PublicKey) error
- func (p *Pod) CloseAllPods() error
- func (p *Pod) ClosePod(podName string) error
- func (p *Pod) CommitFeeds(podName string) error
- func (p *Pod) CreatePod(podName, addressString, podPassword string) (*Info, error)
- func (p *Pod) DeleteOwnPod(podName string) error
- func (p *Pod) DeleteSharedPod(podName string) error
- func (p *Pod) EncryptUploadSubscriptionInfo(podName string, subscriberPublicKey *ecdsa.PublicKey) (string, error)
- func (p *Pod) GetAccount() *account.Account
- func (p *Pod) GetAccountInfo(podName string) (*account.Info, error)
- func (p *Pod) GetFeed() *feed.API
- func (p *Pod) GetMarketplace() ([]datahub.DataHubSub, error)
- func (*Pod) GetName(inode *d.Inode) string
- func (*Pod) GetPath(inode *d.Inode) string
- func (p *Pod) GetPodInfo(podName string) (*Info, string, error)
- func (p *Pod) GetPodInfoFromPodMap(podName string) (*Info, string, error)
- func (p *Pod) GetPodSharingInfo(podName string) (*ShareInfo, error)
- func (p *Pod) GetSubRequests() ([]datahub.DataHubSubRequest, error)
- func (p *Pod) GetSubscribablePodInfo(subHash [32]byte) (*rpc.SubscriptionItemInfo, error)
- func (p *Pod) GetSubscriptions(nameHash [32]byte) ([]datahub.DataHubSubItem, error)
- func (p *Pod) IsOwnPodPresent(podName string) bool
- func (p *Pod) IsPodPresent(podName string) bool
- func (p *Pod) ListPodInMarketplace(podName, title, desc, thumbnail string, price uint64, daysValid uint16, ...) error
- func (p *Pod) ListPods() ([]string, []string, error)
- func (p *Pod) OpenActPod(si *ShareInfo, actName string) (*Info, error)
- func (p *Pod) OpenFromShareInfo(si *ShareInfo) (*Info, error)
- func (p *Pod) OpenPod(podName string) (*Info, error)
- func (p *Pod) OpenPodAsync(ctx context.Context, podName string) (*Info, error)
- func (p *Pod) OpenSubscribedPod(reference []byte, ownerPublicKey *ecdsa.PublicKey) (*Info, error)
- func (p *Pod) OpenSubscribedPodFromReference(reference string, ownerPublicKey *ecdsa.PublicKey) (*Info, error)
- func (p *Pod) PodFork(podName, forkName string) error
- func (p *Pod) PodForkFromRef(forkName, refString string) error
- func (p *Pod) PodList() (*List, error)
- func (p *Pod) PodShare(podName, sharedPodName string) (string, error)
- func (p *Pod) PodStat(podName string) (*Stat, error)
- func (p *Pod) PodStatusInMarketplace(subHash [32]byte, show bool) error
- func (p *Pod) ReceivePod(sharedPodName string, ref utils.Reference) (*Info, error)
- func (p *Pod) ReceivePodInfo(ref utils.Reference) (*ShareInfo, error)
- func (p *Pod) RequestSubscription(subHash, nameHash [32]byte) error
- func (p *Pod) SyncPod(podName string) error
- func (p *Pod) SyncPodAsync(ctx context.Context, podName string) error
- type ShareInfo
- type SharedListItem
- type Stat
Constants ¶
const (
GroupFile = "Groups"
)
const (
// PasswordLength defines the pod password length
PasswordLength = 32
)
Variables ¶
var ( // ErrBlankPodName is returned when a pod name is empty. ErrBlankPodName = errors.New("pod name cannot be blank") // ErrInvalidPodName is returned when a pod name is invalid. ErrInvalidPodName = errors.New("pod does not exist") // ErrTooLongPodName is returned when a pod name is too long. ErrTooLongPodName = errors.New("pod name too long") // ErrPodAlreadyExists is returned when a pod already exists. ErrPodAlreadyExists = errors.New("pod already exists") // ErrForkAlreadyExists is returned when a pod fork already exists. ErrForkAlreadyExists = errors.New("pod with fork name already exists") // ErrMaxPodsReached is returned when the maximum number of pods is reached. ErrMaxPodsReached = errors.New("max number of pods reached") // ErrPodNotOpened is returned when a pod is not opened. ErrPodNotOpened = errors.New("pod not opened") // ErrInvalidDirectory is returned when a directory is invalid. ErrInvalidDirectory = errors.New("invalid directory name") // ErrTooLongDirectoryName is returned when a directory name is too long. ErrTooLongDirectoryName = errors.New("directory name too long") // ErrInvalidFile is returned when a file is invalid. ErrInvalidFile = errors.New("file does not exist") // ErrMaximumPodLimit is returned when the maximum number of pods is reached. ErrMaximumPodLimit = errors.New("maximum number of pods has reached") // ErrBlankPodSharingReference is returned when a pod sharing reference is blank. ErrBlankPodSharingReference = errors.New("pod sharing reference cannot be blank") )
var ( // ErrGroupAlreadyExists is returned when a group already exists ErrGroupAlreadyExists = fmt.Errorf("group already exists") // ErrGroupDoesNotExist is returned when a group does not exist ErrGroupDoesNotExist = fmt.Errorf("group does not exist") ErrPermissionDenied = fmt.Errorf("permission denied") )
Functions ¶
func CleanPodName ¶
CleanPodName trims spaces from a pod name
Types ¶
type DirSnapShot ¶ added in v0.10.1
type DirSnapShot struct { Name string `json:"name"` ContentType string `json:"contentType"` Size string `json:"size,omitempty"` Mode uint32 `json:"mode"` BlockSize string `json:"blockSize,omitempty"` CreationTime string `json:"creationTime"` ModificationTime string `json:"modificationTime"` AccessTime string `json:"accessTime"` FileList []file.MetaData `json:"fileList"` DirList []*DirSnapShot `json:"dirList"` }
type Group ¶ added in v0.10.0
type Group struct {
// contains filtered or unexported fields
}
Group is the main struct which acts on groups
func NewGroup ¶ added in v0.10.0
func NewGroup(client blockstore.Client, feed *feed.API, account *account.Account, acl acl.ACL, logger logging.Logger) *Group
NewGroup creates the main group object which has all the methods related to the groups.
func (*Group) AcceptGroupInvite ¶ added in v0.10.0
func (*Group) CloseGroup ¶ added in v0.10.0
CloseGroup closed an already opened group and removes its information from directory and file data structures.
func (*Group) CreateGroup ¶ added in v0.10.0
CreateGroup creates a new Group
func (*Group) GetGroupInfoFromMap ¶ added in v0.10.0
GetGroupInfoFromMap returns the group info for the given group name.
func (*Group) GetGroupMembers ¶ added in v0.10.0
func (*Group) GetPermission ¶ added in v0.10.0
func (*Group) RemoveGroup ¶ added in v0.10.0
RemoveGroup removes a group
func (*Group) RemoveMember ¶ added in v0.10.0
func (*Group) RemoveSharedGroup ¶ added in v0.10.0
RemoveSharedGroup removes a group from sharedGroup list
type GroupItem ¶ added in v0.10.0
type GroupItem struct { Name string `json:"name"` OwnerPublicKey []byte `json:"ownerPublicKey"` OwnerAddress string `json:"ownerAddress"` Password string `json:"password"` Secret []byte `json:"secret"` }
GroupItem defines the structure for a group
type GroupList ¶ added in v0.10.0
type GroupList struct { Groups []GroupItem `json:"groups"` }
GroupList lists all the groups
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
Info is the struct which holds the pod information
func (*Info) GetAccountInfo ¶
GetAccountInfo returns the pod account info
func (*Info) GetDirectory ¶
GetDirectory returns the directory object
func (*Info) GetDocStore ¶
func (i *Info) GetDocStore() *collection.Document
GetDocStore returns docStore skipcq: TCV-001
func (*Info) GetKVStore ¶
func (i *Info) GetKVStore() *collection.KeyValue
GetKVStore returns kvStore skipcq: TCV-001
func (*Info) GetPodAddress ¶ added in v0.5.3
GetPodAddress returns the pod address
func (*Info) GetPodName ¶ added in v0.5.3
GetPodName returns the pod name
func (*Info) GetPodPassword ¶ added in v0.9.1
GetPodPassword returns the pod password
type List ¶ added in v0.9.2
type List struct { Pods []ListItem `json:"pods"` }
List lists all the pods
type ListItem ¶ added in v0.9.2
type ListItem struct { Name string `json:"name"` Index int `json:"index"` Password string `json:"password"` }
ListItem defines the structure for pod item
type Pod ¶
type Pod struct {
// contains filtered or unexported fields
}
Pod is the main struct which acts on pods
func NewPod ¶
func NewPod(client blockstore.Client, feed *feed.API, account *account.Account, m taskmanager.TaskManagerGO, sm subscriptionManager.SubscriptionManager, feedCacheSize int, feedCacheTTL time.Duration, logger logging.Logger) *Pod
NewPod creates the main pod object which has all the methods related to the pods.
func (*Pod) ApproveSubscription ¶ added in v0.9.3
func (p *Pod) ApproveSubscription(podName string, requestHash [32]byte, subscriberPublicKey *ecdsa.PublicKey) error
ApproveSubscription will send a subscriptionManager request to the owner of the pod
func (*Pod) CloseAllPods ¶ added in v0.10.0
CloseAllPods closes all opened pods and removes their information from directory and file data structures.
func (*Pod) ClosePod ¶
ClosePod closed an already opened pod and removes its information from directory and file data structures.
func (*Pod) CommitFeeds ¶ added in v0.10.0
CommitFeeds commits uncommitted feeds saved in local lru cache to swarm
func (*Pod) DeleteOwnPod ¶ added in v0.7.0
DeleteOwnPod removed a pod and the list of pods belonging to a user.
func (*Pod) DeleteSharedPod ¶ added in v0.7.0
DeleteSharedPod removed a pod and the list of pods shared by other users.
func (*Pod) EncryptUploadSubscriptionInfo ¶ added in v0.9.3
func (p *Pod) EncryptUploadSubscriptionInfo(podName string, subscriberPublicKey *ecdsa.PublicKey) (string, error)
EncryptUploadSubscriptionInfo will upload sub pod info into swarm
func (*Pod) GetAccount ¶ added in v0.5.3
GetAccount returns the account object
func (*Pod) GetAccountInfo ¶
GetAccountInfo returns the pod account info
func (*Pod) GetMarketplace ¶ added in v0.9.3
func (p *Pod) GetMarketplace() ([]datahub.DataHubSub, error)
GetMarketplace will query the smart contract make the `list` all the pod from the marketplace
func (*Pod) GetPodInfo ¶ added in v0.9.3
GetPodInfo returns the pod info for the given pod name.
func (*Pod) GetPodInfoFromPodMap ¶
GetPodInfoFromPodMap returns the pod info for the given pod name.
func (*Pod) GetPodSharingInfo ¶ added in v0.9.3
GetPodSharingInfo returns the raw shareInfo
func (*Pod) GetSubRequests ¶ added in v0.9.3
func (p *Pod) GetSubRequests() ([]datahub.DataHubSubRequest, error)
GetSubRequests will get all owners sub requests
func (*Pod) GetSubscribablePodInfo ¶ added in v0.9.3
func (p *Pod) GetSubscribablePodInfo(subHash [32]byte) (*rpc.SubscriptionItemInfo, error)
GetSubscribablePodInfo will query the smart contract and get info by subHash
func (*Pod) GetSubscriptions ¶ added in v0.9.3
func (p *Pod) GetSubscriptions(nameHash [32]byte) ([]datahub.DataHubSubItem, error)
GetSubscriptions will query the smart contract and list my subscriptions
func (*Pod) IsOwnPodPresent ¶ added in v0.9.3
IsOwnPodPresent checks if a pod is already present for user
func (*Pod) IsPodPresent ¶ added in v0.7.3
IsPodPresent checks if a pod is already present for user
func (*Pod) ListPodInMarketplace ¶ added in v0.9.3
func (p *Pod) ListPodInMarketplace(podName, title, desc, thumbnail string, price uint64, daysValid uint16, category, nameHash [32]byte) error
ListPodInMarketplace will save the pod info in the subscriptionManager smart contract with its owner and price we keep the pod info in the smart contract, with a `list` flag
func (*Pod) OpenActPod ¶ added in v0.10.1
func (*Pod) OpenFromShareInfo ¶ added in v0.9.3
func (*Pod) OpenPod ¶
OpenPod opens a pod if it is not already opened. as part of opening the pod it loads all the data structures related to the pod. Also, it syncs all the files and directories under this pod from the Swarm network.
func (*Pod) OpenPodAsync ¶ added in v0.9.1
OpenPodAsync opens a pod if it is not already opened. as part of opening the pod it loads all the data structures related to the pod. Also, it syncs all the files and directories under this pod from the Swarm network.
func (*Pod) OpenSubscribedPod ¶ added in v0.9.3
OpenSubscribedPod will open a subscribed pod
func (*Pod) OpenSubscribedPodFromReference ¶ added in v0.9.3
func (p *Pod) OpenSubscribedPodFromReference(reference string, ownerPublicKey *ecdsa.PublicKey) (*Info, error)
OpenSubscribedPodFromReference will open a subscribed pod
func (*Pod) PodForkFromRef ¶ added in v0.9.2
PodForkFromRef forks a pof from a given pod sharing reference
func (*Pod) PodList ¶ added in v0.9.1
PodList lists all the available pods belonging to a user in json format.
func (*Pod) PodShare ¶
PodShare makes a pod public by exporting all the pod related information and its address. it does this by creating a sharing reference which points to the information required to import this pod.
func (*Pod) PodStat ¶
PodStat shows all the pod related information like podname and its current address.
func (*Pod) PodStatusInMarketplace ¶ added in v0.9.3
PodStatusInMarketplace will change the `list` flag for the pod so that it's not listed or gets re listed in the pod marketplace
func (*Pod) ReceivePod ¶
ReceivePod imports a pod by creating a new pod with the same name and password
func (*Pod) ReceivePodInfo ¶
ReceivePodInfo returns the shareInfo from the reference
func (*Pod) RequestSubscription ¶ added in v0.9.3
RequestSubscription will send a subscriptionManager request to the owner of the pod will create an escrow account and deposit the `price`
type SharedListItem ¶ added in v0.9.2
type SharedListItem struct {}
SharedListItem defines the structure for shared pod item