chiark / gitweb /
config: Rename PerClient from Ordinary
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Aug 2021 16:56:08 +0000 (17:56 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Aug 2021 18:43:38 +0000 (19:43 +0100)
NFC.  This was really quite confusing because the settings which
default to Ordinary are in fact supposed to be client-agnostic on the
server end.  Right now this is broken.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
macros/macros.rs
src/config.rs

index f190bdb3a431d95c58e05e4d9d524b2868447753..ac1a497df43b2cd68bad8d0b566ddae0fb4f8ee6 100644 (file)
@@ -14,7 +14,7 @@ use itertools::Itertools;
 /// Atrributes:
 ///
 ///  * `limited`, `server`, `client`: cooked sets of settings;
-///    default `SKL` is `Ordinary` except for `limited`
+///    default `SKL` is `PerClient` except for `limited`
 ///  * `special(method, SKL)`
 ///
 /// Generated code
@@ -53,7 +53,7 @@ pub fn resolve(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
     //dbg!(field);
     let fname = &field.ident.as_ref().unwrap();
     let fname_span = fname.span();
-    let mut skl = quote_spanned!{fname_span=> SectionKindList::Ordinary };
+    let mut skl = quote_spanned!{fname_span=> SectionKindList::PerClient };
     let mut method = quote_spanned!{fname_span=> ordinary };
     for attr in &field.attrs {
       let atspan = attr.path.segments.last().unwrap().ident.span();
index f08fe71fe4a206cc1d942faf17cb6c4da4c45f61..77f340125902553be72ded93553b2eea7522e074 100644 (file)
@@ -12,7 +12,7 @@ pub struct InstanceConfig {
   // Exceptional settings
   #[special(special_link, SKL::ServerName)] pub   link:   LinkName,
   pub                                             secret: Secret,
-  #[special(special_ipif, SKL::Ordinary)] pub     ipif:   String,
+  #[special(special_ipif, SKL::PerClient)] pub    ipif:   String,
 
   // Capped settings:
   #[limited]    pub max_batch_down:               u32,
@@ -516,7 +516,7 @@ impl<T:Parseable> Parseable for Vec<T> {
 
 #[derive(Debug,Copy,Clone)]
 enum SectionKindList {
-  Ordinary,
+  PerClient,
   Limited,
   Limits,
   ClientAgnostic,
@@ -533,7 +533,7 @@ impl SectionName {
 impl SectionKindList {
   fn contains(self, s: &SectionName) -> bool {
     match self {
-      SKL::Ordinary       => matches!(s, SN::Link(_)
+      SKL::PerClient      => matches!(s, SN::Link(_)
                                        | SN::Client(_)
                                        | SN::Server(_)
                                        | SN::Common),
@@ -544,8 +544,8 @@ impl SectionKindList {
       SKL::ClientAgnostic => matches!(s, SN::Common
                                        | SN::Server(_)),
 
-      SKL::Limited        => SKL::Ordinary.contains(s)
-                           | SKL::Limits  .contains(s),
+      SKL::Limited        => SKL::PerClient.contains(s)
+                           | SKL::Limits   .contains(s),
 
       SKL::ServerName     => matches!(s, SN::Common)
                            | matches!(s, SN::Server(ServerName(name))
@@ -613,7 +613,7 @@ impl<'c> ResolveContext<'c> {
   pub fn ordinary<T>(&self, key: &'static str) -> T
   where T: Parseable
   {
-    match self.first_of(key, SKL::Ordinary)? {
+    match self.first_of(key, SKL::PerClient)? {
       Some(y) => y,
       None => Parseable::default_for_key(key)?,
     }
@@ -852,7 +852,7 @@ pub fn read(opts: &Opts, end: LinkEnd) -> Vec<InstanceConfig> {
       ],
     };
 
-    if rctx.first_of_raw("secret", SKL::Ordinary).is_none() { continue }
+    if rctx.first_of_raw("secret", SKL::PerClient).is_none() { continue }
 
     let mut ic = InstanceConfig::resolve_instance(&rctx)
       .with_context(|| format!("resolve config for {}", &link))?;