Help us shape the future of Go! Take the 2026 Go Developer Survey

world_mock

package
v0.57.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyNextMsg = errors.New("next_msg field cannot be empty")

ErrEmptyNextMsg is returned if the nextmsg field is empty.

LookupMockOp looks up an operation type for a op type id. returns nil, nil if not found.

View Source
var MockObjectOpId = "hydra/world/mock/mock-object-op"

MockObjectOpId is the mock object operation identifier.

View Source
var MockWorldOpId = "hydra/world/mock/mock-world-op"

MockWorldOpId is the mock object operation identifier.

Functions

func LookupMockObjectOp

func LookupMockObjectOp(ctx context.Context, opTypeID string) (world.Operation, error)

LookupMockObjectOp performs the lookup operation for the mock object op.

func LookupMockWorldOp

func LookupMockWorldOp(ctx context.Context, opTypeID string) (world.Operation, error)

LookupMockWorldOp performs the lookup operation for the mock object op.

func NewMockObjectOpBlock

func NewMockObjectOpBlock() block.Block

NewMockObjectOpBlock constructs a new MockObjectOp block.

func NewMockWorldOpBlock

func NewMockWorldOpBlock() block.Block

NewMockWorldOpBlock constructs a new MockWorldOp block.

func TestWorldEngine

func TestWorldEngine(ctx context.Context, le *logrus.Entry, eng world.Engine) error

TestWorldEngine applies all tests to the world engine.

func TestWorldEngine_Basic

func TestWorldEngine_Basic(ctx context.Context, le *logrus.Entry, eng world.Engine) error

TestWorldEngine_Basic performs basic sanity tests on a world engine.

Types

type MockObjectOp

type MockObjectOp struct {

	// NextMsg sets the next message on the mock object.
	NextMsg string `protobuf:"bytes,1,opt,name=next_msg,json=nextMsg,proto3" json:"nextMsg,omitempty"`
	// contains filtered or unexported fields
}

MockObjectOp is a mock object operation.

func NewMockObjectOp

func NewMockObjectOp(msg string) *MockObjectOp

NewMockObjectOp constructs a new MockObjectOp block.

func (*MockObjectOp) ApplyWorldObjectOp

func (m *MockObjectOp) ApplyWorldObjectOp(
	ctx context.Context,
	le *logrus.Entry,
	objectHandle world.ObjectState,
	sender peer.ID,
) (sysErr bool, err error)

ApplyWorldObjectOp applies the operation as a object operation.

func (*MockObjectOp) ApplyWorldOp

func (m *MockObjectOp) ApplyWorldOp(
	ctx context.Context,
	le *logrus.Entry,
	worldHandle world.WorldState,
	sender peer.ID,
) (sysErr bool, err error)

ApplyWorldOp applies the operation as a world operation.

func (*MockObjectOp) CloneMessageVT

func (m *MockObjectOp) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*MockObjectOp) CloneVT

func (m *MockObjectOp) CloneVT() *MockObjectOp

func (*MockObjectOp) EqualMessageVT

func (this *MockObjectOp) EqualMessageVT(thatMsg any) bool

func (*MockObjectOp) EqualVT

func (this *MockObjectOp) EqualVT(that *MockObjectOp) bool

func (*MockObjectOp) GetNextMsg

func (x *MockObjectOp) GetNextMsg() string

func (*MockObjectOp) GetOperationTypeId

func (m *MockObjectOp) GetOperationTypeId() string

GetOperationTypeId returns the operation type identifier.

func (*MockObjectOp) MarshalBlock

func (m *MockObjectOp) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*MockObjectOp) MarshalJSON

func (x *MockObjectOp) MarshalJSON() ([]byte, error)

MarshalJSON marshals the MockObjectOp to JSON.

func (*MockObjectOp) MarshalProtoJSON

func (x *MockObjectOp) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the MockObjectOp message to JSON.

func (*MockObjectOp) MarshalProtoText

func (x *MockObjectOp) MarshalProtoText() string

func (*MockObjectOp) MarshalToSizedBufferVT

func (m *MockObjectOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*MockObjectOp) MarshalToVT

func (m *MockObjectOp) MarshalToVT(dAtA []byte) (int, error)

func (*MockObjectOp) MarshalVT

func (m *MockObjectOp) MarshalVT() (dAtA []byte, err error)

func (*MockObjectOp) ProtoMessage

func (*MockObjectOp) ProtoMessage()

func (*MockObjectOp) Reset

func (x *MockObjectOp) Reset()

func (*MockObjectOp) SizeVT

func (m *MockObjectOp) SizeVT() (n int)

func (*MockObjectOp) String

func (x *MockObjectOp) String() string

func (*MockObjectOp) UnmarshalBlock

func (m *MockObjectOp) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*MockObjectOp) UnmarshalJSON

func (x *MockObjectOp) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the MockObjectOp from JSON.

func (*MockObjectOp) UnmarshalProtoJSON

func (x *MockObjectOp) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the MockObjectOp message from JSON.

func (*MockObjectOp) UnmarshalVT

func (m *MockObjectOp) UnmarshalVT(dAtA []byte) error

func (*MockObjectOp) Validate

func (m *MockObjectOp) Validate() error

Validate performs cursory checks on the op.

type MockWorldOp

type MockWorldOp struct {

	// ObjectKey is the object key to apply to.
	ObjectKey string `protobuf:"bytes,1,opt,name=object_key,json=objectKey,proto3" json:"objectKey,omitempty"`
	// NextMsg sets the next message on the mock object.
	NextMsg string `protobuf:"bytes,2,opt,name=next_msg,json=nextMsg,proto3" json:"nextMsg,omitempty"`
	// contains filtered or unexported fields
}

MockWorldOp is a mock world operation.

func NewMockWorldOp

func NewMockWorldOp(objectKey, msg string) *MockWorldOp

NewMockWorldOp constructs a new MockWorldOp block.

func (*MockWorldOp) ApplyWorldObjectOp

func (m *MockWorldOp) ApplyWorldObjectOp(
	ctx context.Context,
	le *logrus.Entry,
	objectHandle world.ObjectState,
	sender peer.ID,
) (sysErr bool, err error)

ApplyWorldObjectOp applies the operation as a object operation.

func (*MockWorldOp) ApplyWorldOp

func (m *MockWorldOp) ApplyWorldOp(
	ctx context.Context,
	le *logrus.Entry,
	worldHandle world.WorldState,
	sender peer.ID,
) (sysErr bool, err error)

ApplyWorldOp applies the operation as a world operation.

func (*MockWorldOp) CloneMessageVT

func (m *MockWorldOp) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*MockWorldOp) CloneVT

func (m *MockWorldOp) CloneVT() *MockWorldOp

func (*MockWorldOp) EqualMessageVT

func (this *MockWorldOp) EqualMessageVT(thatMsg any) bool

func (*MockWorldOp) EqualVT

func (this *MockWorldOp) EqualVT(that *MockWorldOp) bool

func (*MockWorldOp) GetNextMsg

func (x *MockWorldOp) GetNextMsg() string

func (*MockWorldOp) GetObjectKey

func (x *MockWorldOp) GetObjectKey() string

func (*MockWorldOp) GetOperationTypeId

func (m *MockWorldOp) GetOperationTypeId() string

GetOperationTypeId returns the operation type identifier.

func (*MockWorldOp) MarshalBlock

func (m *MockWorldOp) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*MockWorldOp) MarshalJSON

func (x *MockWorldOp) MarshalJSON() ([]byte, error)

MarshalJSON marshals the MockWorldOp to JSON.

func (*MockWorldOp) MarshalProtoJSON

func (x *MockWorldOp) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the MockWorldOp message to JSON.

func (*MockWorldOp) MarshalProtoText

func (x *MockWorldOp) MarshalProtoText() string

func (*MockWorldOp) MarshalToSizedBufferVT

func (m *MockWorldOp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*MockWorldOp) MarshalToVT

func (m *MockWorldOp) MarshalToVT(dAtA []byte) (int, error)

func (*MockWorldOp) MarshalVT

func (m *MockWorldOp) MarshalVT() (dAtA []byte, err error)

func (*MockWorldOp) ProtoMessage

func (*MockWorldOp) ProtoMessage()

func (*MockWorldOp) Reset

func (x *MockWorldOp) Reset()

func (*MockWorldOp) SizeVT

func (m *MockWorldOp) SizeVT() (n int)

func (*MockWorldOp) String

func (x *MockWorldOp) String() string

func (*MockWorldOp) UnmarshalBlock

func (m *MockWorldOp) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*MockWorldOp) UnmarshalJSON

func (x *MockWorldOp) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the MockWorldOp from JSON.

func (*MockWorldOp) UnmarshalProtoJSON

func (x *MockWorldOp) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the MockWorldOp message from JSON.

func (*MockWorldOp) UnmarshalVT

func (m *MockWorldOp) UnmarshalVT(dAtA []byte) error

func (*MockWorldOp) Validate

func (m *MockWorldOp) Validate() error

Validate performs cursory checks on the op.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL