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.
 
 
 
hexmap/server/action/syncable.go

20 lines
757 B

package action
import (
"errors"
"go.uber.org/zap/zapcore"
"hexmap-server/state"
)
var ErrNoOp error = errors.New("action's effects were already applied, or it's an empty action")
// Syncable is the interface for action that can be shared.
type Syncable interface {
zapcore.ObjectMarshaler
// 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 ErrNoOp.
// If an action is correctly applied and has an effect, it should return nil.
Apply(s *state.Synced) error
}