status-im / nim-status

MIT License
9 stars 6 forks source link

Add start and stop procs and corresponding enum for tracking state transitions #301

Open michaelsbradleyjr opened 3 years ago

michaelsbradleyjr commented 3 years ago

Related to the concerns in #300.

My proposal:

All public API procs should raise a Defect return an error result if self.runState != RunState.running, except for proc start*(self: StatusObject), and of course proc new*(T: type StatusObject, ...).

michaelsbradleyjr commented 3 years ago

Updated the details above after giving them more thought.

emizzle commented 3 years ago

To prevent forcing implementing clients from having to run stop, disconnect, and logout, we should consider a public api convenience proc that does all three, is async, and returns an error result.