file

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const PROTOCOL = "/fx/file/0.1.1"

Variables

Functions

func ReceiveFile

func ReceiveFile(stream network.Stream, cid string) (io.Reader, error)

func ReceiveFileHandler

func ReceiveFileHandler(req *Request_Receive, api coreiface.CoreAPI, stream network.Stream, ctx context.Context)

func ReceiveMeta

func ReceiveMeta(stream network.Stream, cid string) ([]byte, error)

func ReceiveMetaHandler

func ReceiveMetaHandler(req *Request_Meta, api coreiface.CoreAPI, stream network.Stream, ctx context.Context)

func RequestHandler

func RequestHandler(ctx context.Context, api coreiface.CoreAPI, stream network.Stream)

func SendFile

func SendFile(fileCh <-chan []byte, filemeta *Meta, stream network.Stream, wg *sync.WaitGroup) (*string, error)

func SendFileHandler

func SendFileHandler(req *Request_Send, api coreiface.CoreAPI, stream network.Stream, ctx context.Context)

Types

type Chunk

type Chunk struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*Chunk) Descriptor deprecated

func (*Chunk) Descriptor() ([]byte, []int)

Deprecated: Use Chunk.ProtoReflect.Descriptor instead.

func (*Chunk) GetId

func (x *Chunk) GetId() string

func (*Chunk) ProtoMessage

func (*Chunk) ProtoMessage()

func (*Chunk) ProtoReflect

func (x *Chunk) ProtoReflect() protoreflect.Message

func (*Chunk) Reset

func (x *Chunk) Reset()

func (*Chunk) String

func (x *Chunk) String() string

type File

type File struct {
	Meta        *Meta  `protobuf:"bytes,1,opt,name=meta,proto3" json:"meta,omitempty"`
	ContentPath string `protobuf:"bytes,2,opt,name=contentPath,proto3" json:"contentPath,omitempty"`
	// contains filtered or unexported fields
}

func (*File) Descriptor deprecated

func (*File) Descriptor() ([]byte, []int)

Deprecated: Use File.ProtoReflect.Descriptor instead.

func (*File) GetContentPath

func (x *File) GetContentPath() string

func (*File) GetMeta

func (x *File) GetMeta() *Meta

func (*File) ProtoMessage

func (*File) ProtoMessage()

func (*File) ProtoReflect

func (x *File) ProtoReflect() protoreflect.Message

func (*File) Reset

func (x *File) Reset()

func (*File) String

func (x *File) String() string

type FileMeta

type FileMeta struct {
	// contains filtered or unexported fields
}

func FromFile

func FromFile(path string) (*FileMeta, error)

func (*FileMeta) ToMetaProto

func (m *FileMeta) ToMetaProto() *Meta

type IFileMeta

type IFileMeta interface {
	// contains filtered or unexported methods
}

type Meta

type Meta struct {
	Name         string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type         string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	Size         uint64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
	LastModified int64  `protobuf:"varint,4,opt,name=lastModified,proto3" json:"lastModified,omitempty"`
	// contains filtered or unexported fields
}

func (*Meta) Descriptor deprecated

func (*Meta) Descriptor() ([]byte, []int)

Deprecated: Use Meta.ProtoReflect.Descriptor instead.

func (*Meta) GetLastModified

func (x *Meta) GetLastModified() int64

func (*Meta) GetName

func (x *Meta) GetName() string

func (*Meta) GetSize

func (x *Meta) GetSize() uint64

func (*Meta) GetType

func (x *Meta) GetType() string

func (*Meta) ProtoMessage

func (*Meta) ProtoMessage()

func (*Meta) ProtoReflect

func (x *Meta) ProtoReflect() protoreflect.Message

func (*Meta) Reset

func (x *Meta) Reset()

func (*Meta) String

func (x *Meta) String() string

type Request

type Request struct {

	// Types that are assignable to Type:
	//	*Request_Meta
	//	*Request_Receive
	//	*Request_Send
	Type isRequest_Type `protobuf_oneof:"type"`
	// contains filtered or unexported fields
}

func (*Request) Descriptor deprecated

func (*Request) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetMeta

func (x *Request) GetMeta() string

func (*Request) GetReceive

func (x *Request) GetReceive() *Chunk

func (*Request) GetSend

func (x *Request) GetSend() *Meta

func (*Request) GetType

func (m *Request) GetType() isRequest_Type

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Request_Meta

type Request_Meta struct {
	Meta string `protobuf:"bytes,1,opt,name=meta,proto3,oneof"`
}

type Request_Receive

type Request_Receive struct {
	Receive *Chunk `protobuf:"bytes,2,opt,name=receive,proto3,oneof"`
}

type Request_Send

type Request_Send struct {
	Send *Meta `protobuf:"bytes,3,opt,name=send,proto3,oneof"`
}

Jump to

Keyboard shortcuts

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