socket

package
v0.0.0-...-4310ded Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataSocket

type DataSocket interface {
	// the standard io.Reader interface
	Read(p []byte) (n int, err error)

	// the standard io.Writer interface
	Write(p []byte) (n int, err error)

	// the standard io.Closer interface
	Close() error

	// Set deadline associated with connection (scionftp)
	SetDeadline(t time.Time) error
}

DataSocket describes a data socket is used to send non-control data between the scionftp and server.

type MultiSocket

type MultiSocket struct {
	*ReaderSocket
	*WriterSocket
	// contains filtered or unexported fields
}

func NewMultiSocket

func NewMultiSocket(sockets []DataSocket, maxLength int) *MultiSocket

func (*MultiSocket) Close

func (m *MultiSocket) Close() error

 Only the scionftp should close the socket  Sends the closing message

func (*MultiSocket) SetDeadline

func (m *MultiSocket) SetDeadline(t time.Time) error

type ReadWorker

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

A ReadWorker should be dispatched and runs until it  receives the closing connection  Does not need to be closed since it's closed  automatically

func NewReadWorker

func NewReadWorker(socket DataSocket) *ReadWorker

func (*ReadWorker) Run

func (s *ReadWorker) Run(push chan<- *striping.Segment)

 Keeps running until it receives an EOD flag

type ReaderSocket

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

func NewReadsocket

func NewReadsocket(sockets []DataSocket) *ReaderSocket

func (*ReaderSocket) Close

func (s *ReaderSocket) Close() error

func (*ReaderSocket) Read

func (s *ReaderSocket) Read(p []byte) (n int, err error)

type ScionSocket

type ScionSocket struct {
	*scion.Connection
}

func NewScionSocket

func NewScionSocket(conn *scion.Connection) *ScionSocket

type Socket

type Socket interface {
	io.Reader
	io.Writer
	io.Closer
}

type WriteWorker

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

func NewWriteWorker

func NewWriteWorker(ctx context.Context, wg *sync.WaitGroup, segments chan *striping.Segment, socket DataSocket) *WriteWorker

func (*WriteWorker) Run

func (w *WriteWorker) Run()

 Writes segments until receives cancellation signal on Done()  and sends EOD Header after that.

type WriterSocket

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

func NewWriterSocket

func NewWriterSocket(sockets []DataSocket, maxLength int) *WriterSocket

func (*WriterSocket) Close

func (s *WriterSocket) Close() error

Closing the WriterSocket blocks until until all children have finished sending and then closes all sub-sockets

func (*WriterSocket) FinishAndWait

func (s *WriterSocket) FinishAndWait()

 Should only be called when all segments have been dispatchedReader,  that is, segmentChannel should be empty

func (*WriterSocket) Write

func (s *WriterSocket) Write(p []byte) (n int, err error)

 Will dispatch workers if required and write on  the allocated stream. After writing it is necessary  to call FinishAndWait() to make sure that everything is sent

Jump to

Keyboard shortcuts

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