Documentation
¶
Index ¶
- Variables
- func LookupWorldOp(ctx context.Context, opTypeID string) (world.Operation, error)
- type Transaction
- type Tx
- func (t *Tx) ApplyWorldObjectOp(ctx context.Context, le *logrus.Entry, objectHandle world.ObjectState, ...) (sysErr bool, err error)
- func (t *Tx) ApplyWorldOp(ctx context.Context, le *logrus.Entry, worldHandle world.WorldState, ...) (sysErr bool, err error)
- func (m *Tx) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Tx) CloneVT() *Tx
- func (this *Tx) EqualMessageVT(thatMsg any) bool
- func (this *Tx) EqualVT(that *Tx) bool
- func (x *Tx) GetClusterObjectKey() string
- func (t *Tx) GetOperationTypeId() string
- func (x *Tx) GetTxType() TxType
- func (t *Tx) LocateTx() (Transaction, error)
- func (t *Tx) MarshalBlock() ([]byte, error)
- func (x *Tx) MarshalJSON() ([]byte, error)
- func (x *Tx) MarshalProtoJSON(s *json.MarshalState)
- func (x *Tx) MarshalProtoText() string
- func (m *Tx) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Tx) MarshalToVT(dAtA []byte) (int, error)
- func (m *Tx) MarshalVT() (dAtA []byte, err error)
- func (*Tx) ProtoMessage()
- func (x *Tx) Reset()
- func (m *Tx) SizeVT() (n int)
- func (x *Tx) String() string
- func (t *Tx) UnmarshalBlock(data []byte) error
- func (x *Tx) UnmarshalJSON(b []byte) error
- func (x *Tx) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Tx) UnmarshalVT(dAtA []byte) error
- func (t *Tx) Validate() error
- type TxType
- func (x TxType) Enum() *TxType
- func (x TxType) MarshalJSON() ([]byte, error)
- func (x TxType) MarshalProtoJSON(s *json.MarshalState)
- func (x TxType) MarshalProtoText() string
- func (x TxType) MarshalText() ([]byte, error)
- func (x TxType) String() string
- func (x *TxType) UnmarshalJSON(b []byte) error
- func (x *TxType) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *TxType) UnmarshalText(b []byte) error
- func (t TxType) Validate() error
Constants ¶
This section is empty.
Variables ¶
var ( TxType_name = map[int32]string{ 0: "TxType_INVALID", } TxType_value = map[string]int32{ "TxType_INVALID": 0, } )
Enum value maps for TxType.
var WorldOperationTypeID = "forge/cluster/tx"
WorldOperationTypeID is the transaction object operation type id. Corresponds to a single *TransactionData object.
Functions ¶
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 ¶
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) EqualMessageVT ¶
func (*Tx) GetClusterObjectKey ¶
func (*Tx) GetOperationTypeId ¶
GetOperationTypeId returns the operation type identifier.
func (*Tx) LocateTx ¶
func (t *Tx) LocateTx() (Transaction, error)
LocateTx returns the sub-block for the transaction.
func (*Tx) MarshalBlock ¶
MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.
func (*Tx) MarshalJSON ¶
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 (*Tx) ProtoMessage ¶
func (*Tx) ProtoMessage()
func (*Tx) UnmarshalBlock ¶
UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.
func (*Tx) UnmarshalJSON ¶
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 ¶
type TxType ¶
type TxType int32
TxType indicates the kind of transaction.
const (
TxType_TxType_INVALID TxType = 0
)
func (TxType) MarshalJSON ¶
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 (TxType) MarshalText ¶
MarshalText marshals the TxType to text.
func (*TxType) UnmarshalJSON ¶
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 ¶
UnmarshalText unmarshals the TxType from text.