snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s

This commit is contained in:
upstream-mirror
2026-09-18 01:22:23 +05:00
commit 7e385fc126
8391 changed files with 1766236 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
package dal
// pipelineClobberSteps tries to reduce the amount of pipeline steps by offloading
// higher operations to the lower levels
//
// As an example; the aggregation can be offloaded to the database for faster
// execution.
func pipelineClobberSteps(in Pipeline) (Pipeline, error) {
if len(in) <= 1 {
// Can't optimize further :upsidedownface:
return in, nil
}
// Outline
// - get a nicer pipeline representation
// @todo make the pipeline nicer in the first place
// - traverse from the lief nodes up; try to clobber if the lief node allows it
//
// The clobbering for a branch ends when there is a node that can't be clobbered.
// The progression ends because application level nodes can't be offloaded to.
ll := wrapPpSteps(in)
for _, l := range ll {
for {
// When there is no parent, we can't progress further
if l.parent == nil {
break
}
// if step can't clobber, skip
cs, ok := l.step.(clobberableStep)
if !ok {
break
}
// if child fails to clobber parent, skip to the next child
// @note for now we can end the clobbering if any of the steps
// can't be clobbered as all of the application defined steps
// are focused on the single op. and can't do anything else.
if !cs.clobber(l.parent.step) {
break
}
// if clobbered successfully, update references
if l.parent != nil && l.parent.parent != nil {
// - update child ref of the parent's parent
for i, c := range l.parent.parent.child {
if c == l.parent {
l.parent.parent.child[i] = l
}
}
}
l.parent = l.parent.parent
// @todo for now, clobbering ends after one successfull instance; this is due
// to the current DB implementation doesn't allow nested things.
break
}
}
// convert back to the pipeline representation; update deps in the process
out := make(Pipeline, 0, len(in))
seen := make(map[*ppStepWrap]bool, len(in))
for _, l := range ll {
out = append(out, unwrapPpSteps(l, seen)...)
}
return out, nil
}