Documentation ¶
Index ¶
- Constants
- Variables
- func Handle(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, ...) error
- func HandleDelete(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, path string, ...) error
- func HandleLs(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, path string, ...) error
- func HandleMkDir(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, path string, ...) error
- func HandleRead(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, path string, ...) error
- func HandleWrite(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, path string, ...) error
- func RequestDelete(ctx context.Context, s network.Stream, path string, userDID string) error
- func RequestMkDir(ctx context.Context, s network.Stream, path string, userDID string) (string, error)
- func RequestRead(ctx context.Context, s network.Stream, path string, userDID string) (io.Reader, error)
- func RequestWrite(ctx context.Context, s network.Stream, path string, userDID string, ...) (string, error)
- type ActionType
- type DirEntries
- type DirEntry
- func (*DirEntry) Descriptor() ([]byte, []int)deprecated
- func (x *DirEntry) GetCid() string
- func (x *DirEntry) GetName() string
- func (x *DirEntry) GetSize() int32
- func (x *DirEntry) GetType() EntryType
- func (*DirEntry) ProtoMessage()
- func (x *DirEntry) ProtoReflect() protoreflect.Message
- func (x *DirEntry) Reset()
- func (x *DirEntry) String() string
- type EntryType
- type FSRequest
- func (*FSRequest) Descriptor() ([]byte, []int)deprecated
- func (x *FSRequest) GetAction() ActionType
- func (x *FSRequest) GetDID() string
- func (x *FSRequest) GetPath() string
- func (x *FSRequest) GetSignature() []byte
- func (*FSRequest) ProtoMessage()
- func (x *FSRequest) ProtoReflect() protoreflect.Message
- func (x *FSRequest) Reset()
- func (x *FSRequest) String() string
- type File
- type Payload
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetAction() ActionType
- func (m *Response) GetBody() isResponse_Body
- func (x *Response) GetCid() string
- func (x *Response) GetEntries() *DirEntries
- func (x *Response) GetFile() *File
- func (*Response) ProtoMessage()
- func (x *Response) ProtoReflect() protoreflect.Message
- func (x *Response) Reset()
- func (x *Response) String() string
- type Response_Cid
- type Response_Entries
- type Response_File
Constants ¶
const ProtocolId = "/fx/file/0.2.0"
Variables ¶
var ( ActionType_name = map[int32]string{ 0: "READ", 1: "WRITE", 2: "MKDIR", 3: "LS", 4: "DELETE", } ActionType_value = map[string]int32{ "READ": 0, "WRITE": 1, "MKDIR": 2, "LS": 3, "DELETE": 4, } )
Enum value maps for ActionType.
var ( EntryType_name = map[int32]string{ 0: "FILE", 1: "DIRECTORY", } EntryType_value = map[string]int32{ "FILE": 0, "DIRECTORY": 1, } )
Enum value maps for EntryType.
var File_file_proto protoreflect.FileDescriptor
Functions ¶
func Handle ¶ added in v0.4.7
Handle implement root handler for newFile protocol It reads 2 bytes from the stream which determines the size of the request message It then reads the request message and passes the stream to the appropriate handler
func HandleDelete ¶ added in v0.4.7
func HandleDelete(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, path string, userDID string, s network.Stream) error
HandleDelete handle FSRequest with Delete action, delete a Node at a given location in the user's drive
func HandleLs ¶ added in v0.4.7
func HandleLs(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, path string, userDID string, s network.Stream) error
HandleLs handle FSRequest with Ls action, list entries existing in a given path in a user's drive
func HandleMkDir ¶ added in v0.4.7
func HandleMkDir(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, path string, userDID string, s network.Stream) error
HandleMkDir create a new directory at a given location in the user's drive
func HandleRead ¶ added in v0.4.7
func HandleRead(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, path string, userDID string, s network.Stream) error
HandleRead read a file at a given path from the user's drive
func HandleWrite ¶ added in v0.4.7
func HandleWrite(ctx context.Context, api fxiface.CoreAPI, ds drive.DriveStore, path string, userDID string, s network.Stream) error
HandleWrite handle FSRequest with Write action, write a file at a given location in the user's drive
func RequestDelete ¶ added in v0.4.7
Send and FSRequest for Delete action, wait until receiving an ack (a one byte)
func RequestMkDir ¶ added in v0.4.7
func RequestMkDir(ctx context.Context, s network.Stream, path string, userDID string) (string, error)
RequestMkDir send an FSRequest for MkDir action, wait until receiving a cid for the directory
Types ¶
type ActionType ¶ added in v0.4.7
type ActionType int32
const ( ActionType_READ ActionType = 0 ActionType_WRITE ActionType = 1 ActionType_MKDIR ActionType = 2 ActionType_LS ActionType = 3 ActionType_DELETE ActionType = 4 )
func (ActionType) Descriptor ¶ added in v0.4.7
func (ActionType) Descriptor() protoreflect.EnumDescriptor
func (ActionType) Enum ¶ added in v0.4.7
func (x ActionType) Enum() *ActionType
func (ActionType) EnumDescriptor
deprecated
added in
v0.4.7
func (ActionType) EnumDescriptor() ([]byte, []int)
Deprecated: Use ActionType.Descriptor instead.
func (ActionType) Number ¶ added in v0.4.7
func (x ActionType) Number() protoreflect.EnumNumber
func (ActionType) String ¶ added in v0.4.7
func (x ActionType) String() string
func (ActionType) Type ¶ added in v0.4.7
func (ActionType) Type() protoreflect.EnumType
type DirEntries ¶ added in v0.4.7
type DirEntries struct { Items []*DirEntry `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` // contains filtered or unexported fields }
func RequestLs ¶ added in v0.4.7
func RequestLs(ctx context.Context, s network.Stream, path string, userDID string) (*DirEntries, error)
Send and FSRequest for Ls action, wait until receiving a list of DirEntries
func (*DirEntries) Descriptor
deprecated
added in
v0.4.7
func (*DirEntries) Descriptor() ([]byte, []int)
Deprecated: Use DirEntries.ProtoReflect.Descriptor instead.
func (*DirEntries) GetItems ¶ added in v0.4.7
func (x *DirEntries) GetItems() []*DirEntry
func (*DirEntries) ProtoMessage ¶ added in v0.4.7
func (*DirEntries) ProtoMessage()
func (*DirEntries) ProtoReflect ¶ added in v0.4.7
func (x *DirEntries) ProtoReflect() protoreflect.Message
func (*DirEntries) Reset ¶ added in v0.4.7
func (x *DirEntries) Reset()
func (*DirEntries) String ¶ added in v0.4.7
func (x *DirEntries) String() string
type DirEntry ¶ added in v0.4.7
type DirEntry struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Type EntryType `protobuf:"varint,2,opt,name=type,proto3,enum=file.EntryType" json:"type,omitempty"` Size int32 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` Cid string `protobuf:"bytes,4,opt,name=cid,proto3" json:"cid,omitempty"` // contains filtered or unexported fields }
func (*DirEntry) Descriptor
deprecated
added in
v0.4.7
func (*DirEntry) ProtoMessage ¶ added in v0.4.7
func (*DirEntry) ProtoMessage()
func (*DirEntry) ProtoReflect ¶ added in v0.4.7
func (x *DirEntry) ProtoReflect() protoreflect.Message
type EntryType ¶ added in v0.4.7
type EntryType int32
func (EntryType) Descriptor ¶ added in v0.4.7
func (EntryType) Descriptor() protoreflect.EnumDescriptor
func (EntryType) EnumDescriptor
deprecated
added in
v0.4.7
func (EntryType) Number ¶ added in v0.4.7
func (x EntryType) Number() protoreflect.EnumNumber
func (EntryType) Type ¶ added in v0.4.7
func (EntryType) Type() protoreflect.EnumType
type FSRequest ¶ added in v0.4.7
type FSRequest struct { DID string `protobuf:"bytes,1,opt,name=DID,proto3" json:"DID,omitempty"` Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` Action ActionType `protobuf:"varint,4,opt,name=action,proto3,enum=file.ActionType" json:"action,omitempty"` // contains filtered or unexported fields }
func (*FSRequest) Descriptor
deprecated
added in
v0.4.7
func (*FSRequest) GetAction ¶ added in v0.4.7
func (x *FSRequest) GetAction() ActionType
func (*FSRequest) GetSignature ¶ added in v0.4.7
func (*FSRequest) ProtoMessage ¶ added in v0.4.7
func (*FSRequest) ProtoMessage()
func (*FSRequest) ProtoReflect ¶ added in v0.4.7
func (x *FSRequest) ProtoReflect() protoreflect.Message
type File ¶
type File struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` D []int32 `protobuf:"varint,2,rep,packed,name=d,proto3" json:"d,omitempty"` // contains filtered or unexported fields }
func (*File) Descriptor
deprecated
func (*File) ProtoMessage ¶
func (*File) ProtoMessage()
func (*File) ProtoReflect ¶
func (x *File) ProtoReflect() protoreflect.Message
type Payload ¶ added in v0.4.7
type Payload struct { D []int32 `protobuf:"varint,1,rep,packed,name=d,proto3" json:"d,omitempty"` // contains filtered or unexported fields }
func (*Payload) Descriptor
deprecated
added in
v0.4.7
func (*Payload) ProtoMessage ¶ added in v0.4.7
func (*Payload) ProtoMessage()
func (*Payload) ProtoReflect ¶ added in v0.4.7
func (x *Payload) ProtoReflect() protoreflect.Message
type Response ¶ added in v0.4.7
type Response struct { Action ActionType `protobuf:"varint,1,opt,name=action,proto3,enum=file.ActionType" json:"action,omitempty"` // Types that are assignable to Body: // *Response_File // *Response_Cid // *Response_Entries Body isResponse_Body `protobuf_oneof:"body"` // contains filtered or unexported fields }
func (*Response) Descriptor
deprecated
added in
v0.4.7
func (*Response) GetAction ¶ added in v0.4.7
func (x *Response) GetAction() ActionType
func (*Response) GetEntries ¶ added in v0.4.7
func (x *Response) GetEntries() *DirEntries
func (*Response) ProtoMessage ¶ added in v0.4.7
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶ added in v0.4.7
func (x *Response) ProtoReflect() protoreflect.Message
type Response_Cid ¶ added in v0.4.7
type Response_Cid struct {
Cid string `protobuf:"bytes,3,opt,name=cid,proto3,oneof"`
}
type Response_Entries ¶ added in v0.4.7
type Response_Entries struct {
Entries *DirEntries `protobuf:"bytes,4,opt,name=entries,proto3,oneof"`
}
type Response_File ¶ added in v0.4.7
type Response_File struct {
File *File `protobuf:"bytes,2,opt,name=file,proto3,oneof"`
}