Documentation
¶
Index ¶
- func ReadFile(s *Stream) (*fileinfo.FileInfo, io.Reader, error)
- func ReadHeader(s *Stream) (*pb.Header, error)
- func ReadMessage(s *Stream) ([]byte, error)
- func ReadTransaction(s *Stream) (*pb.Transaction, error)
- func WriteFile(s *Stream, filePath string) error
- func WriteHeader(s *Stream, requestType pb.RequestType, requestId []byte, errorMsg string) error
- func WriteMessage(s *Stream, data []byte) error
- func WriteTransaction(s *Stream, transactionName string, transactionID []byte) error
- type Stream
- func (s *Stream) Close() error
- func (s *Stream) RecvBMessage() ([]byte, error)
- func (s *Stream) RecvFile() (*fileinfo.FileInfo, io.Reader, error)
- func (s *Stream) RecvFileBMessage() ([]byte, *fileinfo.FileInfo, io.Reader, error)
- func (s *Stream) SendBMessage(data []byte) error
- func (s *Stream) SendError(errorMsg string) error
- func (s *Stream) SendFile(filePath string) error
- func (s *Stream) SendFileBMessage(data []byte, filePath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadMessage ¶
func ReadTransaction ¶
func ReadTransaction(s *Stream) (*pb.Transaction, error)
func WriteHeader ¶
func WriteMessage ¶
Types ¶
type Stream ¶
type Stream struct { Stream quic.Stream // contains filtered or unexported fields }
Stream is a stream instance that is created when a transaction is opened. You can send and receive messages and files multiple times within a single transaction.
func New ¶
New creates a new stream instance. This method is used internally by quics-protocol. So, you may don't need to use it directly.
func (*Stream) Close ¶
Close closes the stream. Stream is closed automatically when the transaction is closed. So, you may don't need to use it directly.
func (*Stream) RecvBMessage ¶
RecvBMessage receives a bytes message through the connection. The message data is returned as a result. This method must be used in pairs with SendBMessage.
func (*Stream) RecvFile ¶
RecvFile receives a file through the connection. The file metadata and file data are returned as a result. This method must be used in pairs with SendFile.
func (*Stream) RecvFileBMessage ¶
RecvFileBMessage receives a file with bytes message through the connection. The message data, file metadata, and file data are returned as a result. This method must be used in pairs with SendFileBMessage.
func (*Stream) SendBMessage ¶
SendBMessage sends a bytes message through the connection. The message data needs to be passed as a parameter. This method must be used in pairs with RecvBMessage.
func (*Stream) SendError ¶
Send error sending error message through stream. This method tells the Recv method to receive and return any message. This allows the receiving party to handle errors or close the stream. Even when an error is returned within transactionHandleFunc, this method is used internally to close the stream.
func (*Stream) SendFile ¶
SendFile sends a file through the connection. The file path needs to be passed as a parameter. The metadata of the file is automatically sent to the receiving side. If the filePath is a directory, the directory is sent as a file. This method must be used in pairs with RecvFile.
func (*Stream) SendFileBMessage ¶
SendFileBMessage sends a file with bytes message through the connection. The message data and file path need to be passed as parameters. The metadata of the file is automatically sent to the receiving side. If the filePath is a directory, the directory is sent as a file. This method must be used in pairs with RecvFileBMessage.