serialization

package
v1.25.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 19 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArchivalTaskInfoFromBlob added in v1.19.0

func ArchivalTaskInfoFromBlob(blob []byte, encoding string) (*persistencespb.ArchivalTaskInfo, error)

func ArchivalTaskInfoToBlob added in v1.19.0

func ArchivalTaskInfoToBlob(info *persistencespb.ArchivalTaskInfo) (*commonpb.DataBlob, error)

func HistoryBranchFromBlob

func HistoryBranchFromBlob(blob []byte, encoding string) (*persistencespb.HistoryBranch, error)

func HistoryBranchToBlob

func HistoryBranchToBlob(info *persistencespb.HistoryBranch) (*commonpb.DataBlob, error)

func NewDeserializationError added in v1.10.0

func NewDeserializationError(
	encodingType enumspb.EncodingType,
	deserializationErr error,
) error

NewDeserializationError returns a DeserializationError

func NewSerializationError added in v1.10.0

func NewSerializationError(
	encodingType enumspb.EncodingType,
	serializationErr error,
) error

NewSerializationError returns a SerializationError

func NewUnknownEncodingTypeError added in v1.10.0

func NewUnknownEncodingTypeError(
	providedType string,
	expectedEncoding ...enumspb.EncodingType,
) error

NewUnknownEncodingTypeError returns a new instance of encoding type error

func OutboundTaskInfoFromBlob added in v1.24.0

func OutboundTaskInfoFromBlob(blob []byte, encoding string) (*persistencespb.OutboundTaskInfo, error)

func Proto3Decode added in v1.23.0

func Proto3Decode(blob []byte, e enumspb.EncodingType, result proto.Message) error

func ProtoDecodeBlob added in v1.16.0

func ProtoDecodeBlob(data *commonpb.DataBlob, result proto.Message) error

func ProtoEncodeBlob added in v1.16.0

func ProtoEncodeBlob(m proto.Message, encoding enumspb.EncodingType) (*commonpb.DataBlob, error)

func QueueMetadataFromBlob added in v1.4.0

func QueueMetadataFromBlob(blob []byte, encoding string) (*persistencespb.QueueMetadata, error)

func QueueMetadataToBlob added in v1.4.0

func QueueMetadataToBlob(metadata *persistencespb.QueueMetadata) (*commonpb.DataBlob, error)

func QueueStateFromBlob added in v1.21.0

func QueueStateFromBlob(blob []byte, encoding string) (*persistencespb.QueueState, error)

func QueueStateToBlob added in v1.21.0

func QueueStateToBlob(info *persistencespb.QueueState) (*commonpb.DataBlob, error)

func ReplicationTaskInfoFromBlob

func ReplicationTaskInfoFromBlob(blob []byte, encoding string) (*persistencespb.ReplicationTaskInfo, error)

func ReplicationTaskInfoToBlob

func ReplicationTaskInfoToBlob(info *persistencespb.ReplicationTaskInfo) (*commonpb.DataBlob, error)

func TimerTaskInfoFromBlob

func TimerTaskInfoFromBlob(blob []byte, encoding string) (*persistencespb.TimerTaskInfo, error)

func TimerTaskInfoToBlob

func TimerTaskInfoToBlob(info *persistencespb.TimerTaskInfo) (*commonpb.DataBlob, error)

func TransferTaskInfoFromBlob

func TransferTaskInfoFromBlob(blob []byte, encoding string) (*persistencespb.TransferTaskInfo, error)

func TransferTaskInfoToBlob

func TransferTaskInfoToBlob(info *persistencespb.TransferTaskInfo) (*commonpb.DataBlob, error)

func VisibilityTaskInfoFromBlob added in v1.5.0

func VisibilityTaskInfoFromBlob(blob []byte, encoding string) (*persistencespb.VisibilityTaskInfo, error)

func VisibilityTaskInfoToBlob added in v1.5.0

func VisibilityTaskInfoToBlob(info *persistencespb.VisibilityTaskInfo) (*commonpb.DataBlob, error)

func WorkflowExecutionInfoFromBlob

func WorkflowExecutionInfoFromBlob(blob []byte, encoding string) (*persistencespb.WorkflowExecutionInfo, error)

func WorkflowExecutionStateFromBlob

func WorkflowExecutionStateFromBlob(blob []byte, encoding string) (*persistencespb.WorkflowExecutionState, error)

func WorkflowExecutionStateToBlob

func WorkflowExecutionStateToBlob(info *persistencespb.WorkflowExecutionState) (*commonpb.DataBlob, error)

Types

type DeserializationError added in v1.10.0

type DeserializationError struct {
	// contains filtered or unexported fields
}

DeserializationError is an error type for deserialization

func (*DeserializationError) Error added in v1.10.0

func (e *DeserializationError) Error() string

func (*DeserializationError) IsTerminalTaskError added in v1.23.0

func (e *DeserializationError) IsTerminalTaskError() bool

IsTerminalTaskError informs our task processing subsystem that it is impossible to retry this error and that the task should be sent to a DLQ

func (*DeserializationError) Unwrap added in v1.19.1

func (e *DeserializationError) Unwrap() error

type SerializationError added in v1.10.0

type SerializationError struct {
	// contains filtered or unexported fields
}

SerializationError is an error type for serialization

func (*SerializationError) Error added in v1.10.0

func (e *SerializationError) Error() string

func (*SerializationError) Unwrap added in v1.19.1

func (e *SerializationError) Unwrap() error

type Serializer added in v1.10.0

type Serializer interface {
	SerializeEvents(batch []*historypb.HistoryEvent, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	DeserializeEvents(data *commonpb.DataBlob) ([]*historypb.HistoryEvent, error)

	SerializeEvent(event *historypb.HistoryEvent, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	DeserializeEvent(data *commonpb.DataBlob) (*historypb.HistoryEvent, error)

	SerializeClusterMetadata(icm *persistencespb.ClusterMetadata, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	DeserializeClusterMetadata(data *commonpb.DataBlob) (*persistencespb.ClusterMetadata, error)

	ShardInfoToBlob(info *persistencespb.ShardInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	ShardInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.ShardInfo, error)

	NamespaceDetailToBlob(info *persistencespb.NamespaceDetail, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	NamespaceDetailFromBlob(data *commonpb.DataBlob) (*persistencespb.NamespaceDetail, error)

	HistoryTreeInfoToBlob(info *persistencespb.HistoryTreeInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	HistoryTreeInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.HistoryTreeInfo, error)

	HistoryBranchToBlob(info *persistencespb.HistoryBranch, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	HistoryBranchFromBlob(data *commonpb.DataBlob) (*persistencespb.HistoryBranch, error)

	WorkflowExecutionInfoToBlob(info *persistencespb.WorkflowExecutionInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	WorkflowExecutionInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.WorkflowExecutionInfo, error)

	WorkflowExecutionStateToBlob(info *persistencespb.WorkflowExecutionState, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	WorkflowExecutionStateFromBlob(data *commonpb.DataBlob) (*persistencespb.WorkflowExecutionState, error)

	ActivityInfoToBlob(info *persistencespb.ActivityInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	ActivityInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.ActivityInfo, error)

	ChildExecutionInfoToBlob(info *persistencespb.ChildExecutionInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	ChildExecutionInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.ChildExecutionInfo, error)

	SignalInfoToBlob(info *persistencespb.SignalInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	SignalInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.SignalInfo, error)

	RequestCancelInfoToBlob(info *persistencespb.RequestCancelInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	RequestCancelInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.RequestCancelInfo, error)

	TimerInfoToBlob(info *persistencespb.TimerInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	TimerInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.TimerInfo, error)

	TaskInfoToBlob(info *persistencespb.AllocatedTaskInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	TaskInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.AllocatedTaskInfo, error)

	TaskQueueInfoToBlob(info *persistencespb.TaskQueueInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	TaskQueueInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.TaskQueueInfo, error)

	TaskQueueUserDataToBlob(info *persistencespb.TaskQueueUserData, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	TaskQueueUserDataFromBlob(data *commonpb.DataBlob) (*persistencespb.TaskQueueUserData, error)

	ChecksumToBlob(checksum *persistencespb.Checksum, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	ChecksumFromBlob(data *commonpb.DataBlob) (*persistencespb.Checksum, error)

	QueueMetadataToBlob(metadata *persistencespb.QueueMetadata, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	QueueMetadataFromBlob(data *commonpb.DataBlob) (*persistencespb.QueueMetadata, error)

	ReplicationTaskToBlob(replicationTask *replicationspb.ReplicationTask, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	ReplicationTaskFromBlob(data *commonpb.DataBlob) (*replicationspb.ReplicationTask, error)
	// ParseReplicationTask is unique among these methods in that it does not serialize or deserialize a type to or
	// from a byte array. Instead, it takes a proto and "parses" it into a more structured type.
	ParseReplicationTask(replicationTask *persistencespb.ReplicationTaskInfo) (tasks.Task, error)
	// ParseReplicationTaskInfo is unique among these methods in that it does not serialize or deserialize a type to or
	// from a byte array. Instead, it takes a structured type and "parses" it into proto
	ParseReplicationTaskInfo(task tasks.Task) (*persistencespb.ReplicationTaskInfo, error)

	SerializeTask(task tasks.Task) (*commonpb.DataBlob, error)
	DeserializeTask(category tasks.Category, blob *commonpb.DataBlob) (tasks.Task, error)

	NexusEndpointToBlob(endpoint *persistencespb.NexusEndpoint, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	NexusEndpointFromBlob(data *commonpb.DataBlob) (*persistencespb.NexusEndpoint, error)
}

Serializer is used by persistence to serialize/deserialize objects It will only be used inside persistence, so that serialize/deserialize is transparent for application

func NewSerializer added in v1.10.0

func NewSerializer() Serializer

NewSerializer returns a PayloadSerializer

type TaskSerializer added in v1.13.0

type TaskSerializer struct {
}

func NewTaskSerializer added in v1.13.0

func NewTaskSerializer() *TaskSerializer

func (*TaskSerializer) DeserializeTask added in v1.16.0

func (s *TaskSerializer) DeserializeTask(
	category tasks.Category,
	blob *commonpb.DataBlob,
) (tasks.Task, error)

func (*TaskSerializer) ParseReplicationTask added in v1.23.0

func (s *TaskSerializer) ParseReplicationTask(replicationTask *persistencespb.ReplicationTaskInfo) (tasks.Task, error)

func (*TaskSerializer) ParseReplicationTaskInfo added in v1.25.0

func (s *TaskSerializer) ParseReplicationTaskInfo(task tasks.Task) (*persistencespb.ReplicationTaskInfo, error)

func (*TaskSerializer) SerializeTask added in v1.16.0

func (s *TaskSerializer) SerializeTask(
	task tasks.Task,
) (*commonpb.DataBlob, error)

type UnknownEncodingTypeError added in v1.10.0

type UnknownEncodingTypeError struct {
	// contains filtered or unexported fields
}

UnknownEncodingTypeError is an error type for unknown or unsupported encoding type

func (*UnknownEncodingTypeError) Error added in v1.10.0

func (e *UnknownEncodingTypeError) Error() string

func (*UnknownEncodingTypeError) IsTerminalTaskError added in v1.23.0

func (e *UnknownEncodingTypeError) IsTerminalTaskError() bool

IsTerminalTaskError informs our task processing subsystem that it is impossible to retry this error

Jump to

Keyboard shortcuts

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