Documentation ¶
Index ¶
- func NewBaseFSMSnapshot(fsm *RoutingFSM) raft.FSMSnapshot
- type BaseFSMSnapshot
- type FSM
- type FSMService
- type InMemoryMapService
- func (m *InMemoryMapService) ApplySnapshot(input interface{}) error
- func (m *InMemoryMapService) Get(mapName string, key string) interface{}
- func (m *InMemoryMapService) GetReqDataTypes() []interface{}
- func (m *InMemoryMapService) Name() string
- func (m *InMemoryMapService) NewLog(requestType interface{}, request map[string]interface{}) interface{}
- func (m *InMemoryMapService) Put(mapName string, key string, value interface{})
- func (m *InMemoryMapService) Remove(mapName string, key string)
- type Map
- type MapGetRequest
- type MapPutRequest
- type MapRemoveRequest
- type RoutingFSM
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBaseFSMSnapshot ¶
func NewBaseFSMSnapshot(fsm *RoutingFSM) raft.FSMSnapshot
Types ¶
type BaseFSMSnapshot ¶
func (*BaseFSMSnapshot) Persist ¶
func (i *BaseFSMSnapshot) Persist(sink raft.SnapshotSink) error
func (*BaseFSMSnapshot) Release ¶
func (i *BaseFSMSnapshot) Release()
type FSM ¶
type FSM interface { raft.FSM // Init is used to pass the original serializer from EasyRaft Node to be able to deserialize messages // coming from other nodes Init(ser serializer.Serializer) }
FSM is the interface for using Finite State Machine in Raft Cluster
func NewRoutingFSM ¶
func NewRoutingFSM(services []FSMService) FSM
type FSMService ¶
type FSMService interface { // Name returns the unique ID/Name which will identify the FSM Service when it comes to routing incoming messages Name() string // NewLog is called when a new raft log message is committed in the cluster and matched with any of the GetReqDataTypes returned types // in this method we can handle what should happen when we got a new raft log regarding our FSM service NewLog(requestType interface{}, request map[string]interface{}) interface{} // GetReqDataTypes returns all the request structs which are used by this FSMService GetReqDataTypes() []interface{} // ApplySnapshot is used to decode and apply a snapshot to the FSMService ApplySnapshot(input interface{}) error }
FSMService interface makes it easier to build State Machines
func NewInMemoryMapService ¶
func NewInMemoryMapService() FSMService
type InMemoryMapService ¶
func (*InMemoryMapService) ApplySnapshot ¶
func (m *InMemoryMapService) ApplySnapshot(input interface{}) error
func (*InMemoryMapService) Get ¶
func (m *InMemoryMapService) Get(mapName string, key string) interface{}
func (*InMemoryMapService) GetReqDataTypes ¶
func (m *InMemoryMapService) GetReqDataTypes() []interface{}
func (*InMemoryMapService) Name ¶
func (m *InMemoryMapService) Name() string
func (*InMemoryMapService) NewLog ¶
func (m *InMemoryMapService) NewLog(requestType interface{}, request map[string]interface{}) interface{}
func (*InMemoryMapService) Put ¶
func (m *InMemoryMapService) Put(mapName string, key string, value interface{})
func (*InMemoryMapService) Remove ¶
func (m *InMemoryMapService) Remove(mapName string, key string)
type MapGetRequest ¶
type MapPutRequest ¶
type MapRemoveRequest ¶
type RoutingFSM ¶
type RoutingFSM struct {
// contains filtered or unexported fields
}
func (*RoutingFSM) Apply ¶
func (i *RoutingFSM) Apply(log *raft.Log) interface{}
func (*RoutingFSM) Init ¶
func (i *RoutingFSM) Init(ser serializer.Serializer)
func (*RoutingFSM) Restore ¶
func (i *RoutingFSM) Restore(closer io.ReadCloser) error
func (*RoutingFSM) Snapshot ¶
func (i *RoutingFSM) Snapshot() (raft.FSMSnapshot, error)
Click to show internal directories.
Click to hide internal directories.