MCPcopy Create free account
hub / github.com/cloudbase/garm / loadAllEntities

Method loadAllEntities

workers/cache/cache.go:92–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90}
91
92func (w *Worker) loadAllEntities() error {
93 endpoints, err := w.store.ListGiteaEndpoints(w.ctx)
94 if err != nil {
95 slog.ErrorContext(w.ctx, "failed to load gitea endpoints", "error", err)
96 } else {
97 for _, ep := range endpoints {
98 cache.SetEndpoint(ep)
99 }
100 }
101
102 endpoints, err = w.store.ListGithubEndpoints(w.ctx)
103 if err != nil {
104 slog.ErrorContext(w.ctx, "failed to load github endpoints", "error", err)
105 } else {
106 for _, ep := range endpoints {
107 cache.SetEndpoint(ep)
108 }
109 }
110
111 pools, err := w.store.ListAllPools(w.ctx)
112 if err != nil {
113 return fmt.Errorf("listing pools: %w", err)
114 }
115
116 scaleSets, err := w.store.ListAllScaleSets(w.ctx)
117 if err != nil {
118 return fmt.Errorf("listing scale sets: %w", err)
119 }
120
121 repos, err := w.store.ListRepositories(w.ctx, params.RepositoryFilter{})
122 if err != nil {
123 return fmt.Errorf("listing repositories: %w", err)
124 }
125
126 orgs, err := w.store.ListOrganizations(w.ctx, params.OrganizationFilter{})
127 if err != nil {
128 return fmt.Errorf("listing organizations: %w", err)
129 }
130
131 enterprises, err := w.store.ListEnterprises(w.ctx, params.EnterpriseFilter{})
132 if err != nil {
133 return fmt.Errorf("listing enterprises: %w", err)
134 }
135
136 for _, repo := range repos {
137 if err := w.setCacheForEntity(repo, pools, scaleSets); err != nil {
138 return fmt.Errorf("setting cache for repo: %w", err)
139 }
140 }
141
142 for _, org := range orgs {
143 if err := w.setCacheForEntity(org, pools, scaleSets); err != nil {
144 return fmt.Errorf("setting cache for org: %w", err)
145 }
146 }
147
148 for _, enterprise := range enterprises {
149 if err := w.setCacheForEntity(enterprise, pools, scaleSets); err != nil {

Callers 1

StartMethod · 0.95

Calls 12

setCacheForEntityMethod · 0.95
SetEndpointFunction · 0.92
GetAllEntitiesFunction · 0.92
newToolsUpdaterFunction · 0.85
ListGiteaEndpointsMethod · 0.65
ListGithubEndpointsMethod · 0.65
ListAllPoolsMethod · 0.65
ListAllScaleSetsMethod · 0.65
ListRepositoriesMethod · 0.65
ListOrganizationsMethod · 0.65
ListEnterprisesMethod · 0.65
StartMethod · 0.65

Tested by

no test coverage detected