refactor: update worker processes in EvoBGP to accept dependencies for shared store and job registry. Enhance scheduler, ingest, render, and deploy components to utilize a unified context and improve logging for drift detection. Update architecture documentation to reflect changes in process interactions and worker functionalities.
This commit is contained in:
@@ -284,6 +284,62 @@ func (m *Memory) DemoIDs() (tenant, moduleCDN, moduleIP, revision, speaker strin
|
||||
return m.demoTenantID, m.demoModuleCDN, m.demoModuleIP, m.demoRevisionID, m.demoSpeakerID
|
||||
}
|
||||
|
||||
// ListTenantIDs returns tenant ids sorted lexicographically.
|
||||
func (m *Memory) ListTenantIDs() ([]string, error) {
|
||||
m.mu.RLock()
|
||||
defer m.mu.RUnlock()
|
||||
out := make([]string, 0, len(m.tenants))
|
||||
for id := range m.tenants {
|
||||
out = append(out, id)
|
||||
}
|
||||
sort.Strings(out)
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// CreateRenderRevision stores a new revision and its materialized prefixes.
|
||||
func (m *Memory) CreateRenderRevision(revisionID, tenantID, moduleID string, parentRevisionID *string, contentHash string, previewFragments map[string]string, prefixes []PrefixRow) error {
|
||||
if strings.TrimSpace(revisionID) == "" || strings.TrimSpace(moduleID) == "" || strings.TrimSpace(contentHash) == "" {
|
||||
return ErrInvalidInput
|
||||
}
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
if _, exists := m.revisions[revisionID]; exists {
|
||||
return ErrInvalidInput
|
||||
}
|
||||
mod, ok := m.modules[moduleID]
|
||||
if !ok || mod.DeletedAt != nil || mod.TenantID != tenantID {
|
||||
return ErrNotFound
|
||||
}
|
||||
if parentRevisionID != nil && *parentRevisionID != "" {
|
||||
if pr, ok := m.revisions[*parentRevisionID]; !ok || pr.TenantID != tenantID {
|
||||
return ErrNotFound
|
||||
}
|
||||
}
|
||||
frag := make(map[string]string, len(previewFragments))
|
||||
for k, v := range previewFragments {
|
||||
frag[k] = v
|
||||
}
|
||||
parent := parentRevisionID
|
||||
m.revisions[revisionID] = &Revision{
|
||||
ID: revisionID,
|
||||
TenantID: tenantID,
|
||||
ModuleID: moduleID,
|
||||
ContentHash: contentHash,
|
||||
ParentRevisionID: parent,
|
||||
CreatedAt: time.Now().UTC(),
|
||||
MaterializedPrefixCount: len(prefixes),
|
||||
PreviewFragments: frag,
|
||||
}
|
||||
if len(prefixes) > 0 {
|
||||
cp := make([]PrefixRow, len(prefixes))
|
||||
copy(cp, prefixes)
|
||||
m.revPrefixes[revisionID] = cp
|
||||
} else {
|
||||
m.revPrefixes[revisionID] = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ListModules returns modules for a tenant (sorted by priority, then name).
|
||||
func (m *Memory) ListModules(tenantID string) []*Module {
|
||||
m.mu.RLock()
|
||||
|
||||
Reference in New Issue
Block a user