MCPcopy Create free account
hub / github.com/temporalio/temporal / extractQueueMetadata

Method extractQueueMetadata

common/persistence/sql/queue_v2.go:350–371  ·  view source on GitHub ↗
(metadataRow *sqlplugin.QueueV2MetadataRow)

Source from the content-addressed store, hash-verified

348}
349
350func (q queueV2) extractQueueMetadata(metadataRow *sqlplugin.QueueV2MetadataRow) (*persistencespb.Queue, error) {
351 if metadataRow.MetadataEncoding != enumspb.ENCODING_TYPE_PROTO3.String() {
352 return nil, fmt.Errorf(
353 "queue with type %v and name %v has invalid encoding: %w",
354 metadataRow.QueueType,
355 metadataRow.QueueName,
356 serialization.NewUnknownEncodingTypeError(metadataRow.MetadataEncoding, enumspb.ENCODING_TYPE_PROTO3),
357 )
358 }
359 qm := &persistencespb.Queue{}
360 err := qm.Unmarshal(metadataRow.MetadataPayload)
361 if err != nil {
362 return nil, serialization.NewDeserializationError(
363 enumspb.ENCODING_TYPE_PROTO3,
364 fmt.Errorf("unmarshal payload for queue with type %v and name %v failed: %w",
365 metadataRow.QueueType,
366 metadataRow.QueueName,
367 err),
368 )
369 }
370 return qm, nil
371}
372
373func (q *queueV2) getMaxMessageID(ctx context.Context, queueType persistence.QueueV2Type, queueName string, tc sqlplugin.TableCRUD) (int64, bool, error) {
374 lastMessageID, err := tc.GetLastEnqueuedMessageIDForUpdateV2(ctx, sqlplugin.QueueV2Filter{

Callers 2

getQueueMetadataMethod · 0.95

Calls 5

UnmarshalMethod · 0.95
NewDeserializationErrorFunction · 0.92
StringMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected