add deprecation notices

This commit is contained in:
William Banfield
2022-10-31 17:34:03 -04:00
parent 4b96c401ca
commit ad14bf1e2f
3 changed files with 12 additions and 2 deletions
+4 -2
View File
@@ -47,7 +47,9 @@ type Reactor interface {
//
// Only one of Receive or ReceiveEnvelope are called per message. If ReceiveEnvelope
// is implemented, it will be used, otherwise the switch will fallback to
// using Receive. Receive will be replaced by ReceiveEnvelope in a future version
// using Receive.
// Deprecated: Reactors looking to receive data from a peer should implement ReceiveEnvelope.
// Receive will be deprecated in favor of ReceiveEnvelope in v0.38.
Receive(chID byte, peer Peer, msgBytes []byte)
}
@@ -81,6 +83,6 @@ func (br *BaseReactor) SetSwitch(sw *Switch) {
func (*BaseReactor) GetChannels() []*conn.ChannelDescriptor { return nil }
func (*BaseReactor) AddPeer(peer Peer) {}
func (*BaseReactor) RemovePeer(peer Peer, reason interface{}) {}
func (*BaseReactor) ReceiveEnvelope(e Envelope) {}
func (*BaseReactor) ReceiveEnvelope(e Envelope) {}
func (*BaseReactor) Receive(chID byte, peer Peer, msgBytes []byte) {}
func (*BaseReactor) InitPeer(peer Peer) Peer { return peer }
+5
View File
@@ -40,7 +40,12 @@ type Peer interface {
SendEnvelope(Envelope) bool
TrySendEnvelope(Envelope) bool
// Deprecated: entities looking to act as peers should implement SendEnvelope instead.
// Send will be removed in v0.38.
Send(byte, []byte) bool
// Deprecated: entities looking to act as peers should implement TrySendEnvelope instead.
// TrySend will be removed in v0.38.
TrySend(byte, []byte) bool
Set(string, interface{})
+3
View File
@@ -300,6 +300,9 @@ func (sw *Switch) BroadcastEnvelope(e Envelope) chan bool {
// Broadcasts sends to the peers using the Send method.
//
// NOTE: Broadcast uses goroutines, so order of broadcast may not be preserved.
//
// Deprecated: code looking to broadcast data to all peers should use BroadcastEnvelope.
// Broadcast will be removed in 0.38.
func (sw *Switch) Broadcast(chID byte, msgBytes []byte) chan bool {
sw.Logger.Debug("Broadcast", "channel", chID)