Fixing up build for rust 1.78, hiding things behind cfg(test) etc. (#2753)

* fixing up build for rust 1.78, hiding things behind cfg(test) etc.
* cleaning up version identifier handling in book gen
This commit is contained in:
James Hodgkinson 2024-05-07 09:00:55 +10:00 committed by GitHub
parent a67d1f5160
commit aefcdc5ee8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 48 additions and 34 deletions

View file

@ -41,6 +41,8 @@ jobs:
| awk '{print $1}' \ | awk '{print $1}' \
| sort -t. -k3n,3 -k4n,4 \ | sort -t. -k3n,3 -k4n,4 \
| awk -F'/' '{print $NF}' \ | awk -F'/' '{print $NF}' \
| grep -E '^[[:digit:]]\.[[:digit:]]\.[[:digit:]]' \
| sort -t. \
| tail -n1)" >> $GITHUB_OUTPUT | tail -n1)" >> $GITHUB_OUTPUT
id: branchname id: branchname
- name: Move redirector page - name: Move redirector page

View file

@ -149,16 +149,16 @@ macro_rules! get_identry_raw {
}}; }};
} }
macro_rules! exists_idx { // macro_rules! exists_idx {
( // (
$self:expr, // $self:expr,
$attr:expr, // $attr:expr,
$itype:expr // $itype:expr
) => {{ // ) => {{
// As a cache we have no concept of this, so we just bypass to the db. // // As a cache we have no concept of this, so we just bypass to the db.
$self.db.exists_idx($attr, $itype) // $self.db.exists_idx($attr, $itype)
}}; // }};
} // }
macro_rules! get_idl { macro_rules! get_idl {
( (
@ -342,7 +342,7 @@ pub trait IdlArcSqliteTransaction {
fn get_identry_raw(&self, idl: &IdList) -> Result<Vec<IdRawEntry>, OperationError>; fn get_identry_raw(&self, idl: &IdList) -> Result<Vec<IdRawEntry>, OperationError>;
fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError>; // fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError>;
fn get_idl( fn get_idl(
&mut self, &mut self,
@ -397,9 +397,9 @@ impl<'a> IdlArcSqliteTransaction for IdlArcSqliteReadTransaction<'a> {
get_identry_raw!(self, idl) get_identry_raw!(self, idl)
} }
fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError> { // fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError> {
exists_idx!(self, attr, itype) // exists_idx!(self, attr, itype)
} // }
#[instrument(level = "trace", skip_all)] #[instrument(level = "trace", skip_all)]
fn get_idl( fn get_idl(
@ -492,9 +492,9 @@ impl<'a> IdlArcSqliteTransaction for IdlArcSqliteWriteTransaction<'a> {
get_identry_raw!(self, idl) get_identry_raw!(self, idl)
} }
fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError> { // fn exists_idx(&mut self, attr: &str, itype: IndexType) -> Result<bool, OperationError> {
exists_idx!(self, attr, itype) // exists_idx!(self, attr, itype)
} // }
#[instrument(level = "trace", skip_all)] #[instrument(level = "trace", skip_all)]
fn get_idl( fn get_idl(

View file

@ -163,17 +163,17 @@ trait Plugin {
Err(OperationError::InvalidState) Err(OperationError::InvalidState)
} }
fn pre_repl_incremental( // fn pre_repl_incremental(
_qs: &mut QueryServerWriteTransaction, // _qs: &mut QueryServerWriteTransaction,
_cand: &mut [(EntryIncrementalCommitted, Arc<EntrySealedCommitted>)], // _cand: &mut [(EntryIncrementalCommitted, Arc<EntrySealedCommitted>)],
) -> Result<(), OperationError> { // ) -> Result<(), OperationError> {
admin_error!( // admin_error!(
"plugin {} has an unimplemented pre_repl_incremental!", // "plugin {} has an unimplemented pre_repl_incremental!",
Self::id() // Self::id()
); // );
debug_assert!(false); // debug_assert!(false);
Err(OperationError::InvalidState) // Err(OperationError::InvalidState)
} // }
fn post_repl_incremental_conflict( fn post_repl_incremental_conflict(
_qs: &mut QueryServerWriteTransaction, _qs: &mut QueryServerWriteTransaction,

View file

@ -6,6 +6,9 @@ use std::collections::BTreeSet;
use uuid::Uuid; use uuid::Uuid;
pub type KeyObject = Box<dyn KeyObjectT + Send + Sync + 'static>; pub type KeyObject = Box<dyn KeyObjectT + Send + Sync + 'static>;
// currently only used in testing, so no need to to exist until then
#[cfg(test)]
pub type KeyObjectRef<'a> = &'a (dyn KeyObjectT + Send + Sync + 'static); pub type KeyObjectRef<'a> = &'a (dyn KeyObjectT + Send + Sync + 'static);
pub trait KeyObjectT { pub trait KeyObjectT {

View file

@ -9,7 +9,10 @@ use std::ops::Deref;
use std::sync::Arc; use std::sync::Arc;
use super::internal::KeyProviderInternal; use super::internal::KeyProviderInternal;
use super::object::{KeyObject, KeyObjectRef}; use super::object::KeyObject;
#[cfg(test)]
use super::object::KeyObjectRef;
#[derive(Clone)] #[derive(Clone)]
pub enum KeyProvider { pub enum KeyProvider {
@ -119,8 +122,10 @@ impl KeyProviders {
} }
pub trait KeyProvidersTransaction { pub trait KeyProvidersTransaction {
#[cfg(test)]
fn get_uuid(&self, key_provider_uuid: Uuid) -> Option<&KeyProvider>; fn get_uuid(&self, key_provider_uuid: Uuid) -> Option<&KeyProvider>;
#[cfg(test)]
fn get_key_object(&self, key_object_uuid: Uuid) -> Option<KeyObjectRef>; fn get_key_object(&self, key_object_uuid: Uuid) -> Option<KeyObjectRef>;
fn get_key_object_handle(&self, key_object_uuid: Uuid) -> Option<Arc<KeyObject>>; fn get_key_object_handle(&self, key_object_uuid: Uuid) -> Option<Arc<KeyObject>>;
@ -131,6 +136,7 @@ pub struct KeyProvidersReadTransaction {
} }
impl KeyProvidersTransaction for KeyProvidersReadTransaction { impl KeyProvidersTransaction for KeyProvidersReadTransaction {
#[cfg(test)]
fn get_uuid(&self, key_provider_uuid: Uuid) -> Option<&KeyProvider> { fn get_uuid(&self, key_provider_uuid: Uuid) -> Option<&KeyProvider> {
self.inner self.inner
.deref() .deref()
@ -139,6 +145,7 @@ impl KeyProvidersTransaction for KeyProvidersReadTransaction {
.map(|k| k.as_ref()) .map(|k| k.as_ref())
} }
#[cfg(test)]
fn get_key_object(&self, key_object_uuid: Uuid) -> Option<KeyObjectRef> { fn get_key_object(&self, key_object_uuid: Uuid) -> Option<KeyObjectRef> {
self.inner self.inner
.deref() .deref()
@ -161,6 +168,7 @@ pub struct KeyProvidersWriteTransaction<'a> {
} }
impl<'a> KeyProvidersTransaction for KeyProvidersWriteTransaction<'a> { impl<'a> KeyProvidersTransaction for KeyProvidersWriteTransaction<'a> {
#[cfg(test)]
fn get_uuid(&self, key_provider_uuid: Uuid) -> Option<&KeyProvider> { fn get_uuid(&self, key_provider_uuid: Uuid) -> Option<&KeyProvider> {
self.inner self.inner
.deref() .deref()
@ -169,6 +177,7 @@ impl<'a> KeyProvidersTransaction for KeyProvidersWriteTransaction<'a> {
.map(|k| k.as_ref()) .map(|k| k.as_ref())
} }
#[cfg(test)]
fn get_key_object(&self, key_object_uuid: Uuid) -> Option<KeyObjectRef> { fn get_key_object(&self, key_object_uuid: Uuid) -> Option<KeyObjectRef> {
self.inner self.inner
.deref() .deref()

View file

@ -12,11 +12,11 @@ use std::collections::BTreeSet;
const PEOPLE_PREFIX: &str = "person"; const PEOPLE_PREFIX: &str = "person";
#[derive(Debug)] // #[derive(Debug)]
pub struct PartialGroup { // pub struct PartialGroup {
pub name: String, // pub name: String,
pub members: BTreeSet<String>, // pub members: BTreeSet<String>,
} // }
fn random_name(prefix: &str, rng: &mut ChaCha8Rng) -> String { fn random_name(prefix: &str, rng: &mut ChaCha8Rng) -> String {
let suffix = Alphanumeric.sample_string(rng, 8).to_lowercase(); let suffix = Alphanumeric.sample_string(rng, 8).to_lowercase();