Ejemplo n.º 1
0
func (m *EOM) FollowerExecute(state interfaces.IState) error {

	state.GetFactoidState().EndOfPeriod(int(m.Minute))

	switch state.GetNetworkNumber() {
	case constants.NETWORK_MAIN: // Main Network
		panic("Not implemented yet")
	case constants.NETWORK_TEST: // Test Network
		panic("Not implemented yet")
	case constants.NETWORK_LOCAL: // Local Network

	default:
		panic(fmt.Sprintf("Not implemented yet: Network Number %d", state.GetNetworkNumber()))
	}

	// fmt.Println(state.GetServerState(), constants.SERVER_MODE)

	if m.Minute == 9 {
		state.ProcessEndOfBlock()
		if state.GetServerState() == constants.SERVER_MODE {
			state.LeaderInMsgQueue() <- m
		}
	}

	return nil
}
Ejemplo n.º 2
0
func Leader(state interfaces.IState) {

	for {
		msg := <-state.LeaderInMsgQueue()
		if state.PrintType(msg.Type()) {
			log.Printf("%20s %s\n", "Leader:", msg.String())
		}
		msg.LeaderExecute(state)
	}

}