github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/protocol/networking-streams.go (about)

     1  /* For license and copyright information please see the LEGAL file in the code repository */
     2  
     3  package protocol
     4  
     5  // Streams indicate how stream pools mechanism must behave.
     6  type Streams interface {
     7  	// OutcomeStream make the stream and returns it or return error if any problems occur
     8  	OutcomeStream(service Service) (stream Stream, err Error)
     9  	// IncomeStream make the stream and returns it or return error if any problems occur
    10  	IncomeStream(id uint64) (stream Stream, err Error)
    11  	// Stream returns Stream from pool if exists by given ID
    12  	Stream(id uint64) (stream Stream, err Error)
    13  
    14  	// OpenStream opens a new bidirectional QUIC stream.
    15  	// There is no signaling to the peer about new streams:
    16  	// The peer can only accept the stream after data has been sent on the stream.
    17  	// If the error is non-nil, it satisfies the net.Error interface.
    18  	// When reaching the peer's stream limit, err.Temporary() will be true.
    19  	// If the connection was closed due to a timeout, Timeout() will be true.
    20  	OpenStream() (Stream, error)
    21  	// OpenUniStream opens a new outgoing unidirectional QUIC stream.
    22  	// If the error is non-nil, it satisfies the net.Error interface.
    23  	// When reaching the peer's stream limit, Temporary() will be true.
    24  	// If the connection was closed due to a timeout, Timeout() will be true.
    25  	OpenUniStream() (Stream, error)
    26  }