mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Fix upper_case_acronyms
lint
This commit is contained in:
parent
c42cc3bdcb
commit
fdeadfd981
10 changed files with 78 additions and 78 deletions
|
@ -1,6 +1,6 @@
|
|||
#![deny(clippy::all)]
|
||||
|
||||
use crate::storage::{KVStorage, Storage};
|
||||
use crate::storage::{KvStorage, Storage};
|
||||
use actix_web::{get, middleware::Logger, web, App, HttpServer, Responder, Scope};
|
||||
use api::{api_scope, ServerState};
|
||||
use clap::Arg;
|
||||
|
@ -56,7 +56,7 @@ async fn main() -> anyhow::Result<()> {
|
|||
let data_dir = matches.value_of("data-dir").unwrap();
|
||||
let port = matches.value_of("port").unwrap();
|
||||
|
||||
let server_box: Box<dyn Storage> = Box::new(KVStorage::new(data_dir)?);
|
||||
let server_box: Box<dyn Storage> = Box::new(KvStorage::new(data_dir)?);
|
||||
let server_state = ServerState::new(server_box);
|
||||
|
||||
log::warn!("Serving on port {}", port);
|
||||
|
|
|
@ -20,15 +20,15 @@ fn client_db_key(client_key: Uuid) -> ClientDbKey {
|
|||
*client_key.as_bytes()
|
||||
}
|
||||
|
||||
/// KVStorage is an on-disk storage backend which uses LMDB via the `kv` crate.
|
||||
pub(crate) struct KVStorage<'t> {
|
||||
/// KvStorage is an on-disk storage backend which uses LMDB via the `kv` crate.
|
||||
pub(crate) struct KvStorage<'t> {
|
||||
store: Store,
|
||||
clients_bucket: Bucket<'t, ClientDbKey, ValueBuf<Msgpack<Client>>>,
|
||||
versions_bucket: Bucket<'t, VersionDbKey, ValueBuf<Msgpack<Version>>>,
|
||||
}
|
||||
|
||||
impl<'t> KVStorage<'t> {
|
||||
pub fn new<P: AsRef<Path>>(directory: P) -> anyhow::Result<KVStorage<'t>> {
|
||||
impl<'t> KvStorage<'t> {
|
||||
pub fn new<P: AsRef<Path>>(directory: P) -> anyhow::Result<KvStorage<'t>> {
|
||||
let mut config = Config::default(directory);
|
||||
config.bucket("clients", None);
|
||||
config.bucket("versions", None);
|
||||
|
@ -40,7 +40,7 @@ impl<'t> KVStorage<'t> {
|
|||
let versions_bucket =
|
||||
store.bucket::<VersionDbKey, ValueBuf<Msgpack<Version>>>(Some("versions"))?;
|
||||
|
||||
Ok(KVStorage {
|
||||
Ok(KvStorage {
|
||||
store,
|
||||
clients_bucket,
|
||||
versions_bucket,
|
||||
|
@ -48,7 +48,7 @@ impl<'t> KVStorage<'t> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'t> Storage for KVStorage<'t> {
|
||||
impl<'t> Storage for KvStorage<'t> {
|
||||
fn txn<'a>(&'a self) -> anyhow::Result<Box<dyn StorageTxn + 'a>> {
|
||||
Ok(Box::new(Txn {
|
||||
storage: self,
|
||||
|
@ -58,7 +58,7 @@ impl<'t> Storage for KVStorage<'t> {
|
|||
}
|
||||
|
||||
struct Txn<'t> {
|
||||
storage: &'t KVStorage<'t>,
|
||||
storage: &'t KvStorage<'t>,
|
||||
txn: Option<kv::Txn<'t>>,
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_get_client_empty() -> anyhow::Result<()> {
|
||||
let tmp_dir = TempDir::new("test")?;
|
||||
let storage = KVStorage::new(&tmp_dir.path())?;
|
||||
let storage = KvStorage::new(&tmp_dir.path())?;
|
||||
let mut txn = storage.txn()?;
|
||||
let maybe_client = txn.get_client(Uuid::new_v4())?;
|
||||
assert!(maybe_client.is_none());
|
||||
|
@ -179,7 +179,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_client_storage() -> anyhow::Result<()> {
|
||||
let tmp_dir = TempDir::new("test")?;
|
||||
let storage = KVStorage::new(&tmp_dir.path())?;
|
||||
let storage = KvStorage::new(&tmp_dir.path())?;
|
||||
let mut txn = storage.txn()?;
|
||||
|
||||
let client_key = Uuid::new_v4();
|
||||
|
@ -201,7 +201,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_gvbp_empty() -> anyhow::Result<()> {
|
||||
let tmp_dir = TempDir::new("test")?;
|
||||
let storage = KVStorage::new(&tmp_dir.path())?;
|
||||
let storage = KvStorage::new(&tmp_dir.path())?;
|
||||
let mut txn = storage.txn()?;
|
||||
let maybe_version = txn.get_version_by_parent(Uuid::new_v4(), Uuid::new_v4())?;
|
||||
assert!(maybe_version.is_none());
|
||||
|
@ -211,7 +211,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_add_version_and_gvbp() -> anyhow::Result<()> {
|
||||
let tmp_dir = TempDir::new("test")?;
|
||||
let storage = KVStorage::new(&tmp_dir.path())?;
|
||||
let storage = KvStorage::new(&tmp_dir.path())?;
|
||||
let mut txn = storage.txn()?;
|
||||
|
||||
let client_key = Uuid::new_v4();
|
||||
|
|
|
@ -7,7 +7,7 @@ mod inmemory;
|
|||
pub(crate) use inmemory::InMemoryStorage;
|
||||
|
||||
mod kv;
|
||||
pub(crate) use self::kv::KVStorage;
|
||||
pub(crate) use self::kv::KvStorage;
|
||||
|
||||
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
||||
pub(crate) struct Client {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue