forked from rabbitmq/khepri
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bundle keep-while into a tree record
In most cases in khepri_machine, the keep while conditions are updated along with the root of the tree. This change bundles the root of the tree, the keep while conditions and the keep while condition reverse index into one record. The child commit while refactor functions that currently take the Root and Extra to take the Tree instead and AppliedChanges will be passed as a separate argument.
- Loading branch information
1 parent
a85525e
commit dee8110
Showing
6 changed files
with
76 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
%% This Source Code Form is subject to the terms of the Mozilla Public | ||
%% License, v. 2.0. If a copy of the MPL was not distributed with this | ||
%% file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
%% | ||
%% Copyright © 2021-2023 VMware, Inc. or its affiliates. All rights reserved. | ||
%% | ||
|
||
-include("src/khepri_payload.hrl"). | ||
|
||
%% Structure representing each node in the tree, including the root node. | ||
|
||
-define(INIT_DATA_VERSION, 1). | ||
-define(INIT_CHILD_LIST_VERSION, 1). | ||
-define(INIT_NODE_PROPS, #{payload_version => ?INIT_DATA_VERSION, | ||
child_list_version => ?INIT_CHILD_LIST_VERSION}). | ||
|
||
-record(node, {props = ?INIT_NODE_PROPS :: khepri_machine:props(), | ||
payload = ?NO_PAYLOAD :: khepri_payload:payload(), | ||
child_nodes = #{} :: #{khepri_path:component() := #node{}}}). | ||
|
||
-record(tree, {root :: khepri_machine:tree_node(), | ||
keep_while_conds = #{} :: khepri_machine:keep_while_conds_map(), | ||
keep_while_conds_revidx = #{} :: | ||
khepri_machine:keep_while_conds_revidx()}). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters