MCPcopy Create free account
hub / github.com/comnik/declarative-dataflow / implement_neu

Function implement_neu

src/lib.rs:1018–1127  ·  view source on GitHub ↗

@TODO

(
    name: &str,
    scope: &mut S,
    context: &mut I,
)

Source from the content-addressed store, hash-verified

1016
1017/// @TODO
1018pub fn implement_neu<T, I, S>(
1019 name: &str,
1020 scope: &mut S,
1021 context: &mut I,
1022) -> Result<
1023 (
1024 HashMap<String, Collection<S, Vec<Value>, isize>>,
1025 ShutdownHandle,
1026 ),
1027 Error,
1028>
1029where
1030 T: Timestamp + Lattice + Default,
1031 I: ImplContext<T>,
1032 S: Scope<Timestamp = T>,
1033{
1034 scope.iterative::<u64, _, _>(move |nested| {
1035 let publish = vec![name];
1036 let mut rules = collect_dependencies(&*context, &publish[..])?;
1037
1038 let mut local_arrangements = VariableMap::new();
1039 let mut result_map = HashMap::new();
1040
1041 // Step 0: Canonicalize, check uniqueness of bindings.
1042 if rules.is_empty() {
1043 return Err(Error::not_found(format!(
1044 "Couldn't find any rules for name {}.",
1045 name
1046 )));
1047 }
1048
1049 rules.sort_by(|x, y| x.name.cmp(&y.name));
1050 for index in 1..rules.len() - 1 {
1051 if rules[index].name == rules[index - 1].name {
1052 return Err(Error::conflict(format!(
1053 "Duplicate rule definitions for rule {}",
1054 rules[index].name
1055 )));
1056 }
1057 }
1058
1059 // @TODO at this point we need to know about...
1060 // @TODO ... which rules require recursion (and thus need wrapping in a Variable)
1061 // @TODO ... which rules are supposed to be re-used
1062 // @TODO ... which rules are supposed to be re-synthesized
1063 //
1064 // but based entirely on control data written to the server by something external
1065 // (for the old implement it could just be a decision based on whether the rule has a namespace)
1066
1067 // Step 1: Create new recursive variables for each rule.
1068 for name in publish.iter() {
1069 if context.is_underconstrained(name) {
1070 local_arrangements.insert(
1071 name.to_string(),
1072 Variable::new(nested, Product::new(Default::default(), 1)),
1073 );
1074 }
1075 }

Callers 1

interestMethod · 0.85

Calls 9

collect_dependenciesFunction · 0.85
qFunction · 0.85
cmpMethod · 0.80
is_underconstrainedMethod · 0.80
merge_withMethod · 0.80
tuplesMethod · 0.80
variablesMethod · 0.45
into_bindingsMethod · 0.45
implementMethod · 0.45

Tested by

no test coverage detected