2023-09-05 19:00:40 +01:00
|
|
|
# nimbus-eth1
|
2024-02-01 21:27:48 +00:00
|
|
|
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
2023-09-05 19:00:40 +01:00
|
|
|
# Licensed under either of
|
|
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
|
|
# http://opensource.org/licenses/MIT)
|
|
|
|
# at your option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
|
|
|
import
|
2024-07-18 21:32:32 +00:00
|
|
|
".."/[aristo_desc, aristo_layers]
|
2023-09-05 19:00:40 +01:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Public functions
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
2024-06-03 20:10:35 +00:00
|
|
|
proc deltaMerge*(
|
2024-07-18 21:32:32 +00:00
|
|
|
upper: LayerRef; # Think of `top`, `nil` is ok
|
|
|
|
lower: LayerRef; # Think of `balancer`, `nil` is ok
|
|
|
|
): LayerRef =
|
2023-09-05 19:00:40 +01:00
|
|
|
## Merge argument `upper` into the `lower` filter instance.
|
|
|
|
##
|
|
|
|
## Note that the namimg `upper` and `lower` indicate that the filters are
|
2024-07-18 21:32:32 +00:00
|
|
|
## stacked and the database access is `upper -> lower -> backend`.
|
2023-09-05 19:00:40 +01:00
|
|
|
##
|
|
|
|
if lower.isNil:
|
2024-07-18 21:32:32 +00:00
|
|
|
# Degenerate case: `upper` is void
|
2024-12-18 11:56:46 +01:00
|
|
|
upper
|
2023-09-05 19:00:40 +01:00
|
|
|
|
2024-07-18 21:32:32 +00:00
|
|
|
elif upper.isNil:
|
|
|
|
# Degenerate case: `lower` is void
|
2024-12-18 11:56:46 +01:00
|
|
|
lower
|
2023-09-05 19:00:40 +01:00
|
|
|
|
2024-12-18 11:56:46 +01:00
|
|
|
else:
|
2024-07-18 21:32:32 +00:00
|
|
|
# Can modify `lower` which is the prefered action mode but applies only
|
|
|
|
# in cases where the `lower` argument is not shared.
|
|
|
|
lower.vTop = upper.vTop
|
|
|
|
layersMergeOnto(upper, lower[])
|
2024-12-18 11:56:46 +01:00
|
|
|
lower
|
2023-09-05 19:00:40 +01:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# End
|
|
|
|
# ------------------------------------------------------------------------------
|