registrable_task.go ×5

Frontier kind: Code frontier

unlabeled · c_de64f73de61b

400 tests · 1843 LOC · 78 files · introduces 0 tests · 19 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges19 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
258 ranges1843 lines · 78 files · Browse complete extent
All tests (intent)
400 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 19 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/chasm/registrable_task.go 13 introduced LOC · 5 ranges

Open complete file

160 func (rt *RegistrableTask) registerToLibrary(
161 library namer,
162 > ) (string, uint32, error) { registrable_task.go
163 > if rt.library != nil {
164 return "", 0, fmt.Errorf("task %s is already registered in library %s", rt.taskType, rt.library.Name())
165 }
166
167 > rt.library = library registrable_task.go
168 >
169 > fqn := rt.fqType()
170 > rt.taskTypeID = GenerateTypeID(fqn)
171 > // If outboundTaskGroup wasn't set on creation default it here,
172 > // since this is the first place we will have the fqn.
173 > if rt.outboundTaskGroup == "" {
174 rt.outboundTaskGroup = fqn
175 }
176 > return fqn, rt.taskTypeID, nil registrable_task.go
177 }
178
190 // the library name and the task type. This is used to uniquely identify
191 // the task in the registry.
192 > func (rt *RegistrableTask) fqType() string { registrable_task.go
193 > if rt.library == nil {
194 // this should never happen because the task is only accessible from the library.
195 panic("task is not registered to a library")
196 }
197 > return FullyQualifiedName(rt.library.Name(), rt.taskType) registrable_task.go
198 }
199
go.temporal.io/server/chasm/registry.go 6 introduced LOC · 4 ranges

Open complete file

299 }
300
301 > fqn, id, err := rt.registerToLibrary(lib) registry.go
302 > if err != nil {
303 return err
304 }
305
306 > if _, ok := r.rtByFqn[fqn]; ok { registry.go
307 return fmt.Errorf("task %s is already registered", fqn)
308 }
309
310 > if existingTask, ok := r.rtByID[id]; ok { registry.go
311 return fmt.Errorf("task type ID %d collision between %s and %s", id, fqn, existingTask.fqType())
312 }
313
314 > if !(rt.goType.Kind() == reflect.Struct || registry.go
315 > (rt.goType.Kind() == reflect.Pointer && rt.goType.Elem().Kind() == reflect.Struct)) {
316 return fmt.Errorf("task type %s must be struct or pointer to struct", rt.goType.String())
317 }