cluster_tx

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TxType_name = map[int32]string{
		0: "TxType_INVALID",
	}
	TxType_value = map[string]int32{
		"TxType_INVALID": 0,
	}
)

Enum value maps for TxType.

View Source
var WorldOperationTypeID = "forge/cluster/tx"

WorldOperationTypeID is the transaction object operation type id. Corresponds to a single *TransactionData object.

Functions

func LookupWorldOp

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

LookupWorldOp performs the lookup operation for the pass op types.

Types

type Transaction

type Transaction interface {
	// MarshalVT marshals to binary.
	MarshalVT() ([]byte, error)
	// UnmarshalVT unmarshals from binary.
	UnmarshalVT(data []byte) error

	// GetTxType returns the type of transaction this is.
	GetTxType() TxType
	// Validate performs a cursory check of the transaction.
	// Note: this should not fetch network data.
	Validate() error
	// ExecuteTx executes the transaction against the pass instance.
	// bcs is located at the pass state root.
	// The result is written into bcs.
	ExecuteTx(
		ctx context.Context,
		worldState world.WorldState,
		sender peer.ID,
		objKey string,
		bcs *block.Cursor,
		root *forge_cluster.Cluster,
	) error
}

Transaction is an instance of a transaction object.

type Tx

type Tx struct {

	// TxType is the kind of transaction this is.
	TxType TxType `protobuf:"varint,1,opt,name=tx_type,json=txType,proto3" json:"txType,omitempty"`
	// ClusterObjectKey is the Cluster object ID this is associated with.
	// The Cluster object must already exist.
	ClusterObjectKey string `protobuf:"bytes,2,opt,name=cluster_object_key,json=clusterObjectKey,proto3" json:"clusterObjectKey,omitempty"`
	// contains filtered or unexported fields
}

Tx is the on-the-wire representation of a transaction.

func ByteSliceToTx

func ByteSliceToTx(blk block.Block) (*Tx, error)

ByteSliceToTx converts a byte slice block a Tx. If blk is nil, returns nil, nil If the blk is already parsed to a MockWorldOp, returns the MockWorldOp.

func (*Tx) ApplyWorldObjectOp

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

ApplyWorldObjectOp applies the operation to a world object handle.

func (*Tx) ApplyWorldOp

func (t *Tx) 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 (*Tx) CloneMessageVT

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

func (*Tx) CloneVT

func (m *Tx) CloneVT() *Tx

func (*Tx) EqualMessageVT

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

func (*Tx) EqualVT

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

func (*Tx) GetClusterObjectKey

func (x *Tx) GetClusterObjectKey() string

func (*Tx) GetOperationTypeId

func (t *Tx) GetOperationTypeId() string

GetOperationTypeId returns the operation type identifier.

func (*Tx) GetTxType

func (x *Tx) GetTxType() TxType

func (*Tx) LocateTx

func (t *Tx) LocateTx() (Transaction, error)

LocateTx returns the sub-block for the transaction.

func (*Tx) MarshalBlock

func (t *Tx) MarshalBlock() ([]byte, error)

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

func (*Tx) MarshalJSON

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

MarshalJSON marshals the Tx to JSON.

func (*Tx) MarshalProtoJSON

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

MarshalProtoJSON marshals the Tx message to JSON.

func (*Tx) MarshalProtoText

func (x *Tx) MarshalProtoText() string

func (*Tx) MarshalToSizedBufferVT

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

func (*Tx) MarshalToVT

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

func (*Tx) MarshalVT

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

func (*Tx) ProtoMessage

func (*Tx) ProtoMessage()

func (*Tx) Reset

func (x *Tx) Reset()

func (*Tx) SizeVT

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

func (*Tx) String

func (x *Tx) String() string

func (*Tx) UnmarshalBlock

func (t *Tx) UnmarshalBlock(data []byte) error

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

func (*Tx) UnmarshalJSON

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

UnmarshalJSON unmarshals the Tx from JSON.

func (*Tx) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the Tx message from JSON.

func (*Tx) UnmarshalVT

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

func (*Tx) Validate

func (t *Tx) Validate() error

Validate checks the transaction (cursory checks only)

type TxType

type TxType int32

TxType indicates the kind of transaction.

const (
	TxType_TxType_INVALID TxType = 0
)

func (TxType) Enum

func (x TxType) Enum() *TxType

func (TxType) MarshalJSON

func (x TxType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the TxType to JSON.

func (TxType) MarshalProtoJSON

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

MarshalProtoJSON marshals the TxType to JSON.

func (TxType) MarshalProtoText

func (x TxType) MarshalProtoText() string

func (TxType) MarshalText

func (x TxType) MarshalText() ([]byte, error)

MarshalText marshals the TxType to text.

func (TxType) String

func (x TxType) String() string

func (*TxType) UnmarshalJSON

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

UnmarshalJSON unmarshals the TxType from JSON.

func (*TxType) UnmarshalProtoJSON

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

UnmarshalProtoJSON unmarshals the TxType from JSON.

func (*TxType) UnmarshalText

func (x *TxType) UnmarshalText(b []byte) error

UnmarshalText unmarshals the TxType from text.

func (TxType) Validate

func (t TxType) Validate() error

Validate checks the execution tx type is in range.

Jump to

Keyboard shortcuts

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