Compare commits
	
		
			2 Commits
		
	
	
		
			47645a8fce
			...
			8a3df95491
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8a3df95491 | |||
| c51a81bc13 | 
@ -28,23 +28,31 @@ type Conn interface {
 | 
				
			|||||||
	SetSizeLimit(limit int64)
 | 
						SetSizeLimit(limit int64)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Trans is a HOPP transaction.
 | 
					// Trans is a HOPP transaction. Methods of this interface are not safe for
 | 
				
			||||||
 | 
					// concurrent use with the exception of the Close and ID methods. The
 | 
				
			||||||
 | 
					// recommended use case is one goroutine per transaction.
 | 
				
			||||||
type Trans interface {
 | 
					type Trans interface {
 | 
				
			||||||
	// Close closes the transaction. Any blocked operations will be
 | 
						// Close closes the transaction. Any blocked operations will be
 | 
				
			||||||
	// unblocked and return errors.
 | 
						// unblocked and return errors. This method is safe for concurrent use.
 | 
				
			||||||
	Close() error
 | 
						Close() error
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// ID returns the transaction ID. This must not change, and it must be
 | 
						// ID returns the transaction ID. This must not change, and it must be
 | 
				
			||||||
	// unique within the connection.	
 | 
						// unique within the connection. This method is safe for concurrent use.
 | 
				
			||||||
	ID() int64
 | 
						ID() int64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: add methods for setting send and receive deadlines
 | 
						// TODO: add methods for setting send and receive deadlines
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	// Send sends a message.
 | 
						// Send sends a message. This method is not safe for concurrent use.
 | 
				
			||||||
	Send(method uint16, data []byte) error
 | 
						Send(method uint16, data []byte) error
 | 
				
			||||||
	// Receive receives a message.
 | 
						// SendWriter sends data written to an [io.Writer]. Any writer
 | 
				
			||||||
 | 
						// previously opened through this function will be discarded. This
 | 
				
			||||||
 | 
						// method is not safe for concurrent use, and neither is its result.
 | 
				
			||||||
 | 
						SendWriter(method uint16) (io.Writer, error)
 | 
				
			||||||
 | 
						// Receive receives a message. This method is not safe for concurrent
 | 
				
			||||||
 | 
						// use.
 | 
				
			||||||
	Receive() (method uint16, data []byte, err error)
 | 
						Receive() (method uint16, data []byte, err error)
 | 
				
			||||||
	// ReceiveReader receives a message as an [io.Reader]. Any reader
 | 
						// ReceiveReader receives a message as an [io.Reader]. Any reader
 | 
				
			||||||
	// previously opened through this function will be discarded.
 | 
						// previously opened through this function will be discarded. This
 | 
				
			||||||
 | 
						// method is not safe for concurrent use, and neither is its result.
 | 
				
			||||||
	ReceiveReader() (method uint16, data io.Reader, err error)
 | 
						ReceiveReader() (method uint16, data io.Reader, err error)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user