Add changelog and remove unused code

next
Sayan Nandan 3 years ago
parent f7a4281ed5
commit 88955b62c6
No known key found for this signature in database
GPG Key ID: 8BC07A0A4D41DD52

@ -2,6 +2,18 @@
All changes in this project will be noted in this file.
## Unreleased
### Additions
- Token-based authentication:
- `auth claim`
- `auth login <username> <token>`
- `auth logout`
- `auth adduser <username>`
- `auth deluser <username>`
- Shell now supports multiple `--eval` expressions
## Version 0.7.3
### Additions

@ -54,21 +54,16 @@
//! So, all your data is at the mercy of [`Memstore`]'s constructor
//! and destructor.
#![allow(unused)] // TODO(@ohsayan): Plonk this
use super::KeyspaceResult;
use crate::auth::Authmap;
use crate::corestore::array::Array;
use crate::corestore::htable::Coremap;
use crate::corestore::lock::{QLGuard, QuickLock};
use crate::corestore::table::Table;
use crate::corestore::table::{SystemDataModel, SystemTable};
use crate::registry;
use crate::util::Wrapper;
use core::borrow::Borrow;
use core::hash::Hash;
use core::mem::MaybeUninit;
use core::ops::Deref;
use std::sync::Arc;
uninit_array! {
@ -173,6 +168,7 @@ pub struct Memstore {
impl Memstore {
/// Create a new empty in-memory table with literally nothing in it
#[cfg(test)]
pub fn new_empty() -> Self {
Self {
keyspaces: Coremap::new(),
@ -225,6 +221,7 @@ impl Memstore {
}
None => match self.system.tables.get(&AUTH).unwrap().data {
SystemDataModel::Auth(ref am) => am.clone(),
#[allow(unreachable_patterns)]
_ => unsafe { impossible!() },
},
}
@ -346,8 +343,6 @@ pub struct Keyspace {
/// the replication strategy for this keyspace
#[allow(dead_code)] // TODO: Remove this once we're ready with replication
replication_strategy: cluster::ReplicationStrategy,
/// A **virtual lock** on the partmap for this keyspace
partmap_lock: QuickLock<()>,
}
#[cfg(test)]
@ -368,14 +363,12 @@ impl Keyspace {
ht
},
replication_strategy: cluster::ReplicationStrategy::default(),
partmap_lock: QuickLock::new(()),
}
}
pub fn init_with_all_def_strategy(tables: Coremap<ObjectID, Arc<Table>>) -> Self {
Self {
tables,
replication_strategy: cluster::ReplicationStrategy::default(),
partmap_lock: QuickLock::new(()),
}
}
/// Create a new empty keyspace with zero tables
@ -383,7 +376,6 @@ impl Keyspace {
Self {
tables: Coremap::new(),
replication_strategy: cluster::ReplicationStrategy::default(),
partmap_lock: QuickLock::new(()),
}
}
pub fn table_count(&self) -> usize {
@ -434,16 +426,6 @@ impl Keyspace {
}
}
}
/// Remove a table without doing any reference checks. This will just pull it off
pub unsafe fn force_remove_table(&self, tblid: &ObjectID) {
// atomic remember? nobody cares about the result
self.tables.remove(tblid);
}
pub fn lock_partmap(&self) -> QLGuard<'_, ()> {
self.partmap_lock.lock()
}
}
#[test]

@ -244,12 +244,12 @@ mod syntax_checks {
ONLYAUTH
);
}
#[sky_macros::dbtest_func(port = 2005, norun = true)]
#[sky_macros::dbtest_func(port = 2005, norun = true, auth_testuser = true)]
async fn unknown_auth_action() {
runeq!(
con,
query!("auth", "raspberry"),
Element::RespCode(RespCode::ErrorString("unknown-action".to_owned()))
Element::RespCode(RespCode::ErrorString("Unknown action".to_owned()))
)
}
}

@ -142,27 +142,6 @@ macro_rules! action {
};
}
#[allow(unused_macros)] // TODO(@ohsayan): Remove this if we don't need it anymore
macro_rules! afn_action {
(
$($(#[$attr:meta])*
fn $fname:ident($($argname:ident: $argty:ty),*)
$block:block)*
) => {
$(
$(#[$attr])*
fn $fname<'a, T: 'a, Strm: 'a>($($argname: $argty,)*) ->
core::pin::Pin<std::boxed::Box<dyn core::future::Future<Output = std::io::Result<()>> + Send + Sync + 'a>>
where
T: ProtocolConnectionExt<Strm> + Send + Sync,
Strm: AsyncReadExt + AsyncWriteExt + Unpin + Send + Sync
{
std::boxed::Box::pin(async move {$block})
}
)*
};
}
#[macro_export]
macro_rules! byt {
($f:expr) => {

Loading…
Cancel
Save