Documentation ¶
Overview ¶
Package gogrpcft provides bytes transferring services via gRPC.
Index ¶
- func CreateTransferClient(conn *grpc.ClientConn) pb.TransferClient
- func Receive(client pb.TransferClient, ctx context.Context, ...) (errout error)
- func Send(client pb.TransferClient, ctx context.Context, ...) (errout error)
- type BytesReceiver
- type BytesStreamer
- type BytesTransferServer
- func (s *BytesTransferServer) Receive(in *pb.Info, stream pb.Transfer_ReceiveServer) (errout error)
- func (s *BytesTransferServer) Register(server *grpc.Server)
- func (s *BytesTransferServer) Send(stream pb.Transfer_SendServer) (errout error)
- func (s *BytesTransferServer) SetBytesReceiver(receiver BytesReceiver)
- func (s *BytesTransferServer) SetBytesStreamer(streamer BytesStreamer)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTransferClient ¶
func CreateTransferClient(conn *grpc.ClientConn) pb.TransferClient
CreateTransferClient returns gRPC client given a connection.
func Receive ¶
func Receive(client pb.TransferClient, ctx context.Context, streamerMsg, receiverMsg proto.Message, receiver BytesReceiver) (errout error)
Receive downloads bytes from destination to source.
func Send ¶
func Send(client pb.TransferClient, ctx context.Context, streamerMsg, receiverMsg proto.Message, streamer BytesStreamer) (errout error)
Send uploads bytes from srouce to destination.
Types ¶
type BytesReceiver ¶
type BytesReceiver interface { // Init initialize the receiver. Init(msg proto.Message) error // Push processing the received bytes and their optional additional info. Push(data []byte, metadata proto.Message) error // Finalize clear resources of the receiver. Finalize() error }
BytesReceiver represetns an interface for bytes reception.
type BytesStreamer ¶
type BytesStreamer interface { // Init initialize the streamer. Init(msg proto.Message) error // HasNext returns true if there are more bytes to stream. HasNext() bool // GetNext returns the next bytes with optional additional info. GetNext() ([]byte, proto.Message, error) // Finalize clear resources of the streamer. Finalize() error }
BytesStreamer represents an interface for bytes streaming.
type BytesTransferServer ¶
type BytesTransferServer struct { pb.UnimplementedTransferServer // contains filtered or unexported fields }
BytesTransferServer represents an implementation of bytes transferring gRPC server.
func (*BytesTransferServer) Receive ¶
func (s *BytesTransferServer) Receive(in *pb.Info, stream pb.Transfer_ReceiveServer) (errout error)
Receive is the bytes download implementation of the bytes transferring service. comment: should not be used directly.
func (*BytesTransferServer) Register ¶
func (s *BytesTransferServer) Register(server *grpc.Server)
Register registers a bytes transferring service to a given gRPC server.
func (*BytesTransferServer) Send ¶
func (s *BytesTransferServer) Send(stream pb.Transfer_SendServer) (errout error)
Send is the bytes upload implementation of the bytes transferring service. comment: should not be used directly.
func (*BytesTransferServer) SetBytesReceiver ¶
func (s *BytesTransferServer) SetBytesReceiver(receiver BytesReceiver)
SetBytesReceiver registers a bytes receiver to the gRPC server.
func (*BytesTransferServer) SetBytesStreamer ¶
func (s *BytesTransferServer) SetBytesStreamer(streamer BytesStreamer)
SetBytesStreamer registers a bytes streamer to the gRPC server.