github.com/aergoio/aergo@v1.3.1/p2p/raftsupport/snapshot.go (about) 1 /* 2 * @file 3 * @copyright defined in aergo/LICENSE.txt 4 */ 5 6 package raftsupport 7 8 import ( 9 "github.com/aergoio/aergo/p2p/p2pcommon" 10 "github.com/aergoio/etcd/snap" 11 "io" 12 ) 13 14 // SnapshotIOFactory create SnapshotSender or SnapshotReceiver for a peer 15 type SnapshotIOFactory interface { 16 NewSnapshotSender(peer p2pcommon.RemotePeer) SnapshotSender 17 NewSnapshotReceiver(peer p2pcommon.RemotePeer, rwc io.ReadWriteCloser) SnapshotReceiver 18 } 19 20 type SnapshotSender interface { 21 // Send send snapshot data to target peer and always return the result to snapMsg (i.e. call Message.CloseWithErr() ) 22 Send(snapMsg *snap.Message) 23 } 24 25 type SnapshotReceiver interface { 26 Receive() 27 }