serialization

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 15 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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(msg string) error

NewDeserializationError returns a DeserializationError

func NewSerializationError added in v1.10.0

func NewSerializationError(msg string) error

NewSerializationError returns a SerializationError

func NewUnknownEncodingTypeError added in v1.10.0

func NewUnknownEncodingTypeError(encodingType enumspb.EncodingType) error

NewUnknownEncodingTypeError returns a new instance of encoding type 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 ReplicationTaskInfoFromBlob

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

func ReplicationTaskInfoToBlob

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

func TieredStorageTaskInfoFromBlob added in v1.14.0

func TieredStorageTaskInfoFromBlob(blob []byte, encoding string) (*persistencespb.TieredStorageTaskInfo, error)

func TieredStorageTaskInfoToBlob added in v1.14.0

func TieredStorageTaskInfoToBlob(info *persistencespb.TieredStorageTaskInfo) (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)

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

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

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, clusterName string) (*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)

	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)

	SerializeTransferTasks(taskSlice []tasks.Task) (map[tasks.Key]commonpb.DataBlob, error)
	DeserializeTransferTasks(blobSlice []commonpb.DataBlob) ([]tasks.Task, error)

	SerializeTimerTasks(taskSlice []tasks.Task) (map[tasks.Key]commonpb.DataBlob, error)
	DeserializeTimerTasks(blobSlice []commonpb.DataBlob) ([]tasks.Task, error)
	SerializeVisibilityTasks(taskSlice []tasks.Task) (map[tasks.Key]commonpb.DataBlob, error)
	DeserializeVisibilityTasks(blobSlice []commonpb.DataBlob) ([]tasks.Task, error)
	SerializeTieredStorageTasks(taskSlice []tasks.Task) (map[tasks.Key]commonpb.DataBlob, error)
	DeserializeTieredStorageTasks(blobSlice []commonpb.DataBlob) ([]tasks.Task, error)
	SerializeReplicationTasks(taskSlice []tasks.Task) (map[tasks.Key]commonpb.DataBlob, error)
	DeserializeReplicationTasks(blobSlice []commonpb.DataBlob) ([]tasks.Task, error)

	TransferTaskInfoToBlob(info *persistencespb.TransferTaskInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	TransferTaskInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.TransferTaskInfo, error)
	TimerTaskInfoToBlob(info *persistencespb.TimerTaskInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	TimerTaskInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.TimerTaskInfo, error)
	ReplicationTaskInfoToBlob(info *persistencespb.ReplicationTaskInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	ReplicationTaskInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.ReplicationTaskInfo, error)
	VisibilityTaskInfoToBlob(info *persistencespb.VisibilityTaskInfo, encodingType enumspb.EncodingType) (*commonpb.DataBlob, error)
	VisibilityTaskInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.VisibilityTaskInfo, 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) DeserializeReplicationTasks added in v1.13.0

func (s *TaskSerializer) DeserializeReplicationTasks(
	blobSlice []commonpb.DataBlob,
) ([]tasks.Task, error)

func (*TaskSerializer) DeserializeTieredStorageTasks added in v1.14.0

func (s *TaskSerializer) DeserializeTieredStorageTasks(
	blobSlice []commonpb.DataBlob,
) ([]tasks.Task, error)

func (*TaskSerializer) DeserializeTimerTasks added in v1.13.0

func (s *TaskSerializer) DeserializeTimerTasks(
	blobSlice []commonpb.DataBlob,
) ([]tasks.Task, error)

func (*TaskSerializer) DeserializeTransferTasks added in v1.13.0

func (s *TaskSerializer) DeserializeTransferTasks(
	blobSlice []commonpb.DataBlob,
) ([]tasks.Task, error)

func (*TaskSerializer) DeserializeVisibilityTasks added in v1.13.0

func (s *TaskSerializer) DeserializeVisibilityTasks(
	blobSlice []commonpb.DataBlob,
) ([]tasks.Task, error)

func (*TaskSerializer) ReplicationActivityTaskToProto added in v1.14.0

func (s *TaskSerializer) ReplicationActivityTaskToProto(
	activityTask *tasks.SyncActivityTask,
) *persistencespb.ReplicationTaskInfo

func (*TaskSerializer) ReplicationHistoryTaskToProto added in v1.14.0

func (s *TaskSerializer) ReplicationHistoryTaskToProto(
	historyTask *tasks.HistoryReplicationTask,
) *persistencespb.ReplicationTaskInfo

func (*TaskSerializer) SerializeReplicationTasks added in v1.13.0

func (s *TaskSerializer) SerializeReplicationTasks(
	taskSlice []tasks.Task,
) (map[tasks.Key]commonpb.DataBlob, error)

func (*TaskSerializer) SerializeTieredStorageTasks added in v1.14.0

func (s *TaskSerializer) SerializeTieredStorageTasks(
	taskSlice []tasks.Task,
) (map[tasks.Key]commonpb.DataBlob, error)

func (*TaskSerializer) SerializeTimerTasks added in v1.13.0

func (s *TaskSerializer) SerializeTimerTasks(
	taskSlice []tasks.Task,
) (map[tasks.Key]commonpb.DataBlob, error)

func (*TaskSerializer) SerializeTransferTasks added in v1.13.0

func (s *TaskSerializer) SerializeTransferTasks(
	taskSlice []tasks.Task,
) (map[tasks.Key]commonpb.DataBlob, error)

func (*TaskSerializer) SerializeVisibilityTasks added in v1.13.0

func (s *TaskSerializer) SerializeVisibilityTasks(
	taskSlice []tasks.Task,
) (map[tasks.Key]commonpb.DataBlob, error)

func (*TaskSerializer) TieredStorageTaskToProto added in v1.14.0

func (s *TaskSerializer) TieredStorageTaskToProto(
	tieredStorageTask *tasks.TieredStorageTask,
) *persistencespb.TieredStorageTaskInfo

func (*TaskSerializer) TimerActivityRetryTaskToProto added in v1.14.0

func (s *TaskSerializer) TimerActivityRetryTaskToProto(
	activityRetryTimer *tasks.ActivityRetryTimerTask,
) *persistencespb.TimerTaskInfo

func (*TaskSerializer) TimerActivityTaskToProto added in v1.14.0

func (s *TaskSerializer) TimerActivityTaskToProto(
	activityTimer *tasks.ActivityTimeoutTask,
) *persistencespb.TimerTaskInfo

func (*TaskSerializer) TimerUserTaskToProto added in v1.14.0

func (s *TaskSerializer) TimerUserTaskToProto(
	userTimer *tasks.UserTimerTask,
) *persistencespb.TimerTaskInfo

func (*TaskSerializer) TimerWorkflowCleanupTaskToProto added in v1.14.0

func (s *TaskSerializer) TimerWorkflowCleanupTaskToProto(
	workflowCleanupTimer *tasks.DeleteHistoryEventTask,
) *persistencespb.TimerTaskInfo

func (*TaskSerializer) TimerWorkflowDelayTaskToProto added in v1.14.0

func (s *TaskSerializer) TimerWorkflowDelayTaskToProto(
	workflowDelayTimer *tasks.WorkflowBackoffTimerTask,
) *persistencespb.TimerTaskInfo

func (*TaskSerializer) TimerWorkflowRunToProto added in v1.14.0

func (s *TaskSerializer) TimerWorkflowRunToProto(
	workflowTimer *tasks.WorkflowTimeoutTask,
) *persistencespb.TimerTaskInfo

func (*TaskSerializer) TimerWorkflowTaskToProto added in v1.14.0

func (s *TaskSerializer) TimerWorkflowTaskToProto(
	workflowTimer *tasks.WorkflowTaskTimeoutTask,
) *persistencespb.TimerTaskInfo

func (*TaskSerializer) TransferActivityTaskToProto added in v1.14.0

func (s *TaskSerializer) TransferActivityTaskToProto(
	activityTask *tasks.ActivityTask,
) *persistencespb.TransferTaskInfo

func (*TaskSerializer) TransferChildWorkflowTaskToProto added in v1.14.0

func (s *TaskSerializer) TransferChildWorkflowTaskToProto(
	childWorkflowTask *tasks.StartChildExecutionTask,
) *persistencespb.TransferTaskInfo

func (*TaskSerializer) TransferCloseTaskToProto added in v1.14.0

func (s *TaskSerializer) TransferCloseTaskToProto(
	closeTask *tasks.CloseExecutionTask,
) *persistencespb.TransferTaskInfo

func (*TaskSerializer) TransferRequestCancelTaskToProto added in v1.14.0

func (s *TaskSerializer) TransferRequestCancelTaskToProto(
	requestCancelTask *tasks.CancelExecutionTask,
) *persistencespb.TransferTaskInfo

func (*TaskSerializer) TransferResetTaskToProto added in v1.14.0

func (s *TaskSerializer) TransferResetTaskToProto(
	resetTask *tasks.ResetWorkflowTask,
) *persistencespb.TransferTaskInfo

func (*TaskSerializer) TransferSignalTaskToProto added in v1.14.0

func (s *TaskSerializer) TransferSignalTaskToProto(
	signalTask *tasks.SignalExecutionTask,
) *persistencespb.TransferTaskInfo

func (*TaskSerializer) TransferWorkflowTaskToProto added in v1.14.0

func (s *TaskSerializer) TransferWorkflowTaskToProto(
	workflowTask *tasks.WorkflowTask,
) *persistencespb.TransferTaskInfo

func (*TaskSerializer) VisibilityCloseTaskToProto added in v1.14.0

func (s *TaskSerializer) VisibilityCloseTaskToProto(
	closetVisibilityTask *tasks.CloseExecutionVisibilityTask,
) *persistencespb.VisibilityTaskInfo

func (*TaskSerializer) VisibilityDeleteTaskToProto added in v1.14.0

func (s *TaskSerializer) VisibilityDeleteTaskToProto(
	deleteVisibilityTask *tasks.DeleteExecutionVisibilityTask,
) *persistencespb.VisibilityTaskInfo

func (*TaskSerializer) VisibilityStartTaskToProto added in v1.14.0

func (s *TaskSerializer) VisibilityStartTaskToProto(
	startVisibilityTask *tasks.StartExecutionVisibilityTask,
) *persistencespb.VisibilityTaskInfo

func (*TaskSerializer) VisibilityUpsertTaskToProto added in v1.14.0

func (s *TaskSerializer) VisibilityUpsertTaskToProto(
	upsertVisibilityTask *tasks.UpsertExecutionVisibilityTask,
) *persistencespb.VisibilityTaskInfo

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

Jump to

Keyboard shortcuts

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