Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseError ¶
func (*CloseError) Error ¶
func (e *CloseError) Error() string
type CloseRequest ¶
type CloseRequest struct {
ConnectionID ID
}
type ConnectRejectError ¶
func (*ConnectRejectError) Error ¶
func (e *ConnectRejectError) Error() string
type ConnectRequest ¶
type ConnectResponse ¶
type ConnectResponse struct { ConnectionID ID // Errors represent any errors that may have occurred during processing of the request // that the receiver would like to make the sender aware of. // This is distinct from the decision to not accept the connection for whatever business // logic reasons, which should be signaled using the Accept flag and RejectReasons. // // If Errors is both non-nil and non-empty, then the values of Accept and RejectReasons // are ignored. // // The underlying transport may use this to notify the sender of errors or may use some // other method to inform the sender-side transport layer that it should signal an error. Errors []string Accepted bool RejectReasons []string }
type Connection ¶
type Connection interface { ID() ID Sender() peer.ID Witness() peer.ID // SetWitness returns a connection that is identical to the receiver with the addition of having the witness value be the specified peerID. // // This operation return a Connection to allow immutable implementations, but implementations may also allow mutation. However, if an // implementation allows mutation, it must return the receiver. When using this method, it is best practice to discard the receiver // and only refer to the returned value from that point forward. SetWitness(peerID peer.ID) (Connection, error) Receiver() peer.ID Status() Status // SetStatus returns a connection that is identical to the receiver with the addition of having the status now equaling the supplied argument. // // This operation return a Connection to allow immutable implementations, but implementations may also allow mutation. However, if an // implementation allows mutation, it must return the receiver. When using this method, it is best practice to discard the receiver // and only refer to the returned value from that point forward. SetStatus(status Status) (Connection, error) }
type ConnectionStore ¶
type ConnectionStore interface { // Update allows modification of the connection specified by the provided id. // // The connection returned from writeFunc is used to persist any changes. This applies // even if writeFunc also returns an error. Return a nil connection to signal that no // persistence should occur. // // This funcction only calls writeFunc if the connection exists. If no connection is found, // this operation returns an error. Update(id ID, writeFunc func(conn Connection) (Connection, error)) error // Read allows concurrent access to a connection but does not allow modification. // // This function does not ensure that the connection exists and calls readFunc regardless. // As such any nil checking must be performed in readFunc. Read(id ID, readFunc func(conn Connection) error) error Create(sender, receiver peer.Peer, status Status) (ID, error) Accept(id ID, sender, receiver peer.Peer, status Status) error All() ([]ID, error) }
ConnetionStore is an interface for some backing storage for the Clarinet connections a node has. All operations on types implementing this interface must provide concurrency safety.
type ID ¶
func NewRandomID ¶
type Options ¶
type Options struct {
WitnessSelector WitnessSelector
}
type Status ¶
type Status interface { String() string // contains filtered or unexported methods }
func AwaitingWitness ¶
func AwaitingWitness() Status
func NotifyingOfWitness ¶
func NotifyingOfWitness() Status
func RequestingReceiver ¶
func RequestingReceiver() Status
func RequestingSender ¶
func RequestingSender() Status
func RequestingWitness ¶
func RequestingWitness() Status
type WitnessNotification ¶
type WitnessRejectError ¶
func (*WitnessRejectError) Error ¶
func (e *WitnessRejectError) Error() string
type WitnessRequest ¶
type WitnessResponse ¶
type WitnessResponse struct { ConnectionID ID // Errors represent any errors that may have occurred during processing of the request // that the receiver would like to make the sender aware of. // This is distinct from the decision to not accept the connection for whatever business // logic reasons, which should be signaled using the Accept flag and RejectReasons. // // If Errors is both non-nil and non-empty, then the values of Accept and RejectReasons // are ignored. // // The underlying transport may use this to notify the sender of errors or may use some // other method to inform the sender-side transport layer that it should signal an error. Errors []string Accepted bool RejectReasons []string }
type WitnessSelector ¶
type WitnessSelector interface { String() string // contains filtered or unexported methods }
func ParseWitnessSelector ¶
func ParseWitnessSelector(s string) (WitnessSelector, error)
func WitnessSelectorReceiver ¶
func WitnessSelectorReceiver() WitnessSelector
func WitnessSelectorSender ¶
func WitnessSelectorSender() WitnessSelector
Click to show internal directories.
Click to hide internal directories.