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

Method GetTaskQueueUserData

service/frontend/admin_handler.go:1863–1916  ·  view source on GitHub ↗
(
	ctx context.Context,
	request *adminservice.GetTaskQueueUserDataRequest,
)

Source from the content-addressed store, hash-verified

1861}
1862
1863func (adh *AdminHandler) GetTaskQueueUserData(
1864 ctx context.Context,
1865 request *adminservice.GetTaskQueueUserDataRequest,
1866) (_ *adminservice.GetTaskQueueUserDataResponse, err error) {
1867 defer log.CapturePanic(adh.logger, &err)
1868
1869 if request == nil {
1870 return nil, errRequestNotSet
1871 }
1872 if len(request.Namespace) == 0 {
1873 return nil, errNamespaceNotSet
1874 }
1875
1876 // Admin API takes namespace name; matching requires namespace ID.
1877 namespaceID, err := adh.namespaceRegistry.GetNamespaceID(namespace.Name(request.GetNamespace()))
1878 if err != nil {
1879 return nil, err
1880 }
1881
1882 // Build the partition object to get its wire-format RPC name.
1883 // partition_id=0 (root) → bare task queue name, e.g. "my-queue".
1884 // partition_id=N → mangled name, e.g. "/_sys/my-queue/N".
1885 // The matching client uses this name for consistent-hash routing to the correct host,
1886 // and the matching engine parses it to find the right in-memory partition manager.
1887 // namespaceID is passed for correctness even though RpcName() only uses the task queue name.
1888 family, err := tqid.NewTaskQueueFamily(namespaceID.String(), request.GetTaskQueue())
1889 if err != nil {
1890 return nil, err
1891 }
1892 partition := family.TaskQueue(request.GetTaskQueueType()).NormalPartition(int(request.GetPartitionId()))
1893
1894 // Fetch the user data currently loaded by the target partition.
1895 // LastKnownUserDataVersion=0: no cached version, always return current data.
1896 // LastKnownEphemeralDataVersion=-1: skip ephemeral data; we only need persisted per-type data.
1897 resp, err := adh.matchingClient.GetTaskQueueUserData(ctx, &matchingservice.GetTaskQueueUserDataRequest{
1898 NamespaceId: namespaceID.String(),
1899 TaskQueue: partition.RpcName(),
1900 TaskQueueType: request.GetTaskQueueType(),
1901 LastKnownUserDataVersion: 0,
1902 LastKnownEphemeralDataVersion: -1,
1903 })
1904 if err != nil {
1905 return nil, err
1906 }
1907
1908 // User data is a family-level map keyed by TaskQueueType (int32).
1909 // Extract only the entry for the requested type and return it alongside the version,
1910 // so callers can compare versions across partitions to check replication lag.
1911 perType := resp.GetUserData().GetData().GetPerType()
1912 return &adminservice.GetTaskQueueUserDataResponse{
1913 UserData: perType[int32(request.GetTaskQueueType())],
1914 Version: resp.GetUserData().GetVersion(),
1915 }, nil
1916}
1917
1918func (adh *AdminHandler) DeleteWorkflowExecution(
1919 ctx context.Context,

Callers

nothing calls this directly

Calls 15

TaskQueueMethod · 0.95
CapturePanicFunction · 0.92
NameTypeAlias · 0.92
NewTaskQueueFamilyFunction · 0.92
NormalPartitionMethod · 0.80
GetPerTypeMethod · 0.80
GetNamespaceIDMethod · 0.65
GetNamespaceMethod · 0.65
StringMethod · 0.65
GetTaskQueueMethod · 0.65
GetTaskQueueUserDataMethod · 0.65
RpcNameMethod · 0.65

Tested by

no test coverage detected