You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

18 lines
708 B

package syncable
import (
"errors"
"hexmap-server/state"
)
var ErrorNoOp error = errors.New("action's effects were already applied, or it's an empty action")
// Action is the interface for actions that can be shared.
type Action interface {
// Apply causes the action's effects to be applied to s, mutating it in place.
// All syncable.Actions must conform to the standard that if an action can't be correctly applied, or if it would
// have no effect, it returns an error without changing s.
// If an action can be correctly applied but would have no effect, it should return ErrorNoOp.
// If an action is correctly applied and has an effect, it should return nil.
Apply(s *state.Synced) error
}