Open parkan opened 5 years ago
this is probably generalizable to peer-star-app, but it's easier to think about in terms of a concrete application so I'm opening this here for now
This would be very useful for tests as well.
Here are some fun FSM links:
This looks like a nifty library I haven’t tried yet:
https://github.com/davidkpiano/xstate
Here’s a simple lib for UIs from the Choo project:
https://github.com/choojs/nanostate/
The really interesting stuff is “Finite State Transducers”, which are used for things like speech recognition... the Kaldi project uses OpenFST (C++):
FSTs look like a cool extension of FSMs but I really hope we don't have to use probabilistic state transitions anytime soon 😅
nanostate reminds me of the first real website I worked on, which badly needed a state machine because it played music (hypem.com)
Some of the heavier-duty computer science-y stuff is probably going to be necessary if we go in the direction of trying to model the state of peer-to-peer swarms ... there's a lot of state in something like that!
I was playing around with XState, and I made a little prototype of using it to drive a simulation using peer-base...
For reference, this relates to: https://github.com/peer-base/peer-base/issues/227
aggregating concerns from:
The Problem
peer-pad can be in a variety of states, depending on interactions between your peer, other peers in the collaboration, other peers in the app (but not in your collaboration), and pinners:
etc
this results in confusing feedback for users, difficulty in debugging, and erratic behavior
FSM Solution
intuitively, these state can be represented by a finite state machine, describing valid states and transitions between them. It might be convenient to represent the state as tuples of
(app state, collaboration state, pinner state)
like(online, synchronized, sending)
this can get pretty complicated as the number of possible states is large, but it's worth trying to sketch out to see just how hairy it gets
libp2p has recently implemented the dialFSM Connection State Machine, which can form the basis and example for our effort