MCPcopy Create free account
hub / github.com/driangle/taskmd / get

Method get

apps/cli/internal/web/project_resolver.go:53–80  ·  view source on GitHub ↗

get returns a cached projectContext for the given ID, creating one on first access.

(id string)

Source from the content-addressed store, hash-verified

51
52// get returns a cached projectContext for the given ID, creating one on first access.
53func (pr *ProjectResolver) get(id string) (*projectContext, error) {
54 pr.mu.RLock()
55 if ctx, ok := pr.cache[id]; ok {
56 pr.mu.RUnlock()
57 return ctx, nil
58 }
59 pr.mu.RUnlock()
60
61 pr.mu.Lock()
62 defer pr.mu.Unlock()
63
64 // Double-check after acquiring write lock.
65 if ctx, ok := pr.cache[id]; ok {
66 return ctx, nil
67 }
68
69 scanDir, phases, err := pr.resolve(id)
70 if err != nil {
71 return nil, err
72 }
73
74 ctx := &projectContext{
75 dp: NewDataProvider(scanDir, pr.verbose),
76 phases: phases,
77 }
78 pr.cache[id] = ctx
79 return ctx, nil
80}
81
82// projectMiddleware resolves ?project=<id> and injects the DataProvider into request context.
83func projectMiddleware(resolver *ProjectResolver, next http.Handler) http.Handler {

Callers 15

projectMiddlewareFunction · 0.80
issueRangeFunction · 0.80
checkRequiredFieldsFunction · 0.80
checkEnumFieldsFunction · 0.80
checkArrayFieldsFunction · 0.80
checkDateFieldsFunction · 0.80
checkVerifyStepsFunction · 0.80

Calls 1

NewDataProviderFunction · 0.85