File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 6060 "err-code" : " ^1.1.2" ,
6161 "length-prefixed-stream" : " ^1.6.0" ,
6262 "protons" : " ^1.0.1" ,
63- "pull-pushable" : " ^2.2.0"
63+ "pull-pushable" : " ^2.2.0" ,
64+ "time-cache" : " ^0.3.0"
6465 },
6566 "contributors" : [
6667 " Vasco Santos <[email protected] >"
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const EventEmitter = require('events')
44const pull = require ( 'pull-stream/pull' )
55const empty = require ( 'pull-stream/sources/empty' )
66const asyncEach = require ( 'async/each' )
7-
7+ const TimeCache = require ( 'time-cache' )
88const debug = require ( 'debug' )
99const errcode = require ( 'err-code' )
1010
@@ -31,6 +31,20 @@ class PubsubBaseProtocol extends EventEmitter {
3131 this . multicodec = multicodec
3232 this . libp2p = libp2p
3333 this . started = false
34+
35+ /**
36+ * Map of topics to which peers are subscribed to
37+ *
38+ * @type {Map<string, Peer> }
39+ */
40+ this . topics = new Map ( )
41+
42+ /**
43+ * Cache of seen messages
44+ *
45+ * @type {TimeCache }
46+ */
47+ this . seenCache = new TimeCache ( )
3448
3549 /**
3650 * Map of peers.
You can’t perform that action at this time.
0 commit comments