Init initializes the oracle.
()
| 44 | |
| 45 | // Init initializes the oracle. |
| 46 | func (o *Oracle) Init() { |
| 47 | o.commits = make(map[uint64]uint64) |
| 48 | // Remove the older btree file, before creating NewTree, as it may contain stale data leading |
| 49 | // to wrong results. |
| 50 | o.keyCommit = z.NewTree("oracle") |
| 51 | o.subscribers = make(map[int]chan pb.OracleDelta) |
| 52 | o.updates = make(chan *pb.OracleDelta, 100000) // Keeping 1 second worth of updates. |
| 53 | o.doneUntil.Init(nil) |
| 54 | go o.sendDeltasToSubscribers() |
| 55 | } |
| 56 | |
| 57 | // close releases the memory associated with btree used for keycommit. |
| 58 | func (o *Oracle) close() { |
nothing calls this directly
no test coverage detected