Documentation
¶
Index ¶
- func PathSlice(path string) []string
- type DeleteFileOpts
- type DriveIndex
- type DrivePrivateSpace
- type DrivePublicSpace
- type DriveSpace
- type DriveSpaceType
- type DriveStore
- type ListEntriesOpts
- type ListEntry
- type MkDirOpts
- type ReadFileOpts
- type UserDrive
- func (ud *UserDrive) IsNull() bool
- func (ud *UserDrive) PrivateSpace(ctx context.Context, api fxiface.CoreAPI) (*DrivePrivateSpace, error)
- func (ud *UserDrive) PublicSpace(ctx context.Context, api fxiface.CoreAPI) (*DrivePublicSpace, error)
- func (ud *UserDrive) Publish(ctx context.Context, api fxiface.CoreAPI) error
- type WriteFileOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeleteFileOpts ¶
type DeleteFileOpts struct {
}
type DriveIndex ¶
type DriveIndex struct {
// contains filtered or unexported fields
}
An in-memory list of drives which acts as a testing infra for DriveStore
func NewDriveStore ¶
func NewDriveStore() *DriveIndex
Create a DriveIndex with an empty list of drives
func (*DriveIndex) Put ¶
func (di *DriveIndex) Put(d UserDrive) error
Put a new drive in the DriveStore, if the drive already exists, returns a "drive already exists" error
func (*DriveIndex) Resolve ¶
func (di *DriveIndex) Resolve(userDID string) (UserDrive, error)
Resolve a Drive based on UserDID, if the drive does not exist returns a "Drive not found" error
func (*DriveIndex) ResolveCreate ¶
func (di *DriveIndex) ResolveCreate(userDID string) (UserDrive, error)
Resolve a Drive based on UserDID, if the drive does not exist creates one, puts it in the store and returns it
func (*DriveIndex) Update ¶
func (di *DriveIndex) Update(d UserDrive) error
Update an existing drive in the Drive store, if the drive does not exist, returns a "drive does not exist" error
type DrivePrivateSpace ¶
type DrivePrivateSpace struct {
DriveSpace
}
Private space inside a Drive
func (*DrivePrivateSpace) ReadFile ¶
func (ds *DrivePrivateSpace) ReadFile(p string, options ReadFileOpts) (pfs.EncodedFile, error)
Reads a file from private space in a drive at a give location, it returns and additional JWE byte array
func (*DrivePrivateSpace) WriteFile ¶
func (ds *DrivePrivateSpace) WriteFile(p string, file files.File, jwe []byte, options WriteFileOpts) (string, error)
Writes a file into private space in a drive at a given location, it takes a byte array called JWE in addition to DrivePublicSpace.WriteFile
type DrivePublicSpace ¶
type DrivePublicSpace struct {
DriveSpace
}
Public space inside a Drive
func (*DrivePublicSpace) ReadFile ¶
func (ds *DrivePublicSpace) ReadFile(p string, options ReadFileOpts) (files.File, error)
Reads a file from the drive at a given location
func (*DrivePublicSpace) WriteFile ¶
func (ds *DrivePublicSpace) WriteFile(p string, file files.File, options WriteFileOpts) (string, error)
Writes a file into drive at a given location (in public space).
type DriveSpace ¶
type DriveSpace struct {
Ctx context.Context
Api fxiface.CoreAPI
SpaceType DriveSpaceType
RootCid string
RootDir files.Directory
}
DriveSpace holds information about a space inside a user's drive A drive space can be either Private or Public, SpactType indicates this
func (*DriveSpace) DeleteFile ¶
func (ds *DriveSpace) DeleteFile(p string, options DeleteFileOpts) (string, error)
Deletes a file at a given location on the drive
func (*DriveSpace) ListEntries ¶
func (ds *DriveSpace) ListEntries(p string, options ListEntriesOpts) (<-chan ipfsifsce.DirEntry, error)
List all of entries in a path
type DriveSpaceType ¶
type DriveSpaceType string
const ( PublicDriveSpaceType DriveSpaceType = "public" PrivateDriveSpaceType DriveSpaceType = "private" )
type DriveStore ¶
type DriveStore interface {
Resolve(string) (UserDrive, error)
ResolveCreate(string) (UserDrive, error)
Put(UserDrive) error
Update(UserDrive) error
}
Interface for a Drive Store. DriveStore handles logic for discovering, updating and persisting a drive
type ListEntriesOpts ¶
type ListEntriesOpts struct {
}
type ReadFileOpts ¶
type ReadFileOpts struct {
}
type UserDrive ¶
type UserDrive struct {
UserDID string
PrivateSpaceCid string
PublicSpaceCid string
Dirs map[string]string
// contains filtered or unexported fields
}
UserDrive holds necessary info to identify a user's drive on the network It holds info about user's ID, root cids for each space and a DriveStore instance
func NewDrive ¶
func NewDrive(userDID string, ds DriveStore) UserDrive
Create a new null Drive, the only field set is the UserDID, other fields are initialized by first call to Publish
func (*UserDrive) PrivateSpace ¶
func (ud *UserDrive) PrivateSpace(ctx context.Context, api fxiface.CoreAPI) (*DrivePrivateSpace, error)
Create a DrivePrivateSpace struct. PrivateSpace creates a Directory instance by getting the root cid of the drive using FS API
func (*UserDrive) PublicSpace ¶
func (ud *UserDrive) PublicSpace(ctx context.Context, api fxiface.CoreAPI) (*DrivePublicSpace, error)
Create a DrivePublicSpace struct. PublicSpace creates a Directory instance by getting the root cid of the drive using FS API
type WriteFileOpts ¶
type WriteFileOpts struct {
}